The single most valuable property a pipeline can have
An idempotent pipeline produces the same result whether you run it once, twice, or twenty times. Once you have this property, debugging is no longer terrifying — "just rerun it" becomes a real answer instead of a hopeful prayer. Without it, every retry is a roll of the dice.
The four practical patterns that make pipelines idempotent
- Path-encoded immutability for raw lakes.
raw/orders/2026/04/30/run_20260430120000.json.gz. The path itself includes the run timestamp. A second run writes a new file alongside; a downstream stage reads the latest by lexicographic order. - Partition replace for analytical tables.
warehouse/orders/date=2026-04-30/. Rerunning replaces the partition atomically (stage + swap). - Upsert by primary key for OLTP-shaped destinations.
INSERT ... ON CONFLICT (order_id) DO UPDATE. Same key wins; rerun is a no-op-by-result. - Idempotent side effects for things-that-aren't-data — emails, webhooks, alerts. Use a deduplication key ("alert about Q1 revenue threshold for 2026-04-30") and a tracking table.