DT3: Building reliable pipelines

Lesson 3 of 5 · reading 15–25 minutes; practice and project time is on the module page

Incremental loads, backfills and late data

🎯You'll be able to

Load only what's new, re-load past days on purpose (a backfill), and handle files that arrive late or are corrected.

🏠The everyday picture

A newspaper's archive adds today's paper each morning, without reprinting the last ten years. If yesterday's edition had a mistake, they replace that one edition.

📘What it really is

📝A worked example

Input: load all 30 days, then edit a copy of 2026-10-12.csv so one line has qty 3 instead of 2, and load that date again.

Expected output: the row count stays 10,181 and only that line's amount changes, because the solution replaces the rows from that file. (Keep the edited file outside raw/, or regenerate the raw data afterwards with python tools/generate.py.)

🌍Where it's used

📝Case scenario

A telecom's usage report loaded only rows newer than the last run's newest timestamp. One tower's data arrived six hours late with older timestamps, and was skipped for good. A look-back window of 24 hours, with idempotent merging, picked up late rows on the next run.

🖱️Try it

Delete data/sabzisathi.duckdb, then load only 1 to 10 October with ten --date runs, then the whole month with --all. Success: the final counts match a single --all run exactly.

⚠️Common mistakes

🛠️For your project

Project 2 test 9 re-loads a day and rebuilds the warehouse, and expects the same totals.

✅Quick check

What is a backfill?

Show the answer

Re-running past periods on purpose, for example after fixing a bug.

Why does a look-back window help?

Show the answer

It picks up rows that arrived late with older timestamps.

← PreviousSafe to run again (idempotent loads)
ProLearners Assist