Data Engineering
Reliable ETL Workflows: Validation, Retries, and Idempotency
How to build data workflows that resume safely, reject bad input, avoid duplicate effects, and explain failures in production.
Assume every dependency will fail
A data job that works once is a script. A production workflow must survive changing source formats, incomplete rows, rate limits, network interruptions, process restarts, and database contention.
I classify failures as retryable, rejectable, or requiring human review. This prevents retrying permanent data errors forever or discarding temporary infrastructure failures as bad records.
Validate before transformation
Raw input should be retained or traceable, then checked for schema, types, identifiers, ranges, and cross-field rules. Invalid records go to a quarantine path with a useful reason instead of disappearing into a generic exception log.
Transformation functions are easier to test when deterministic: the same validated input produces the same normalized output without hidden network or database calls.
Make replay safe
Retries are safe when repeated work does not create repeated effects. Stable source identifiers, uniqueness, upserts, and idempotency records let a job resume after interruption. Checkpoints should represent completed durable work, not the last loop iteration attempted.
When an external side effect cannot share a transaction with the database, an outbox or explicit delivery state provides a recoverable handoff.
Log decisions, not noise
Useful structured events include the job, source, record identifier, stage, attempt, duration, outcome, and error category. Aggregated counts should reconcile received, accepted, rejected, and committed records.
The goal is a workflow that can answer what happened, what remains, and whether it is safe to run again. That clarity separates automation that saves time from automation that creates hidden work.
Continue exploring
See the relevant solution, implementation context, or discuss a related software project.