← All case files
// case file
CASE / 09
Idempotent ETL
SNOSQLPYT
EXTRACTSTAGEMERGEVALIDATERE-RUN = SAME RESULTWATERMARK · MERGE KEYCASE 09IDEMPOTENT INCREMENTAL ETL
● Shippedcase file · 09 / 16
Case
#09
Where
Yosi Health
Categories
Snowflake · Python
Read
~2 min
/09

Idempotent Incremental ETL Framework

SnowflakeSQLPython
Watermark tracking, merge upserts, late-arriving data validation, control tables for recovery. Daily pipelines hardened for safe reruns.
+
The Problem

Daily pipelines occasionally failed mid-run or produced duplicates after partial recovery. Engineers had to manually clean state before reruns, and late-arriving source records silently corrupted aggregates. Trust in the data was eroding.

The Approach

Designed an incremental framework around three principles: deterministic watermark tracking, merge-based upserts (never plain inserts), and explicit validation gates. Every run logs to a control table; every failure can be safely retried without manual cleanup.

Technical Details
  • Watermark column tracked per source-target pair
  • MERGE statements with deterministic match keys
  • Validation queries for duplicates and gaps
  • Late-arriving record detection & backfill logic
  • Control tables track state for surgical recovery
100%
Idempotent
Daily
Cadence
~min
Recovery time