All engineering notes

Data integration

Making data imports safe to retry

Use stable identifiers and keep enough context for an operator to replay a failed import.

Design the workflow

Validate records before writing them. Use a stable source key and a database uniqueness constraint to prevent duplicates when a batch is retried.

Test interrupted imports

Interrupt a batch after some records are committed. Replay it and verify that committed records appear once, rejected rows can be inspected, and the import log links to the original batch.