Arman Pouyaei Start a conversation
Lesson 39  ·  Nov 25, 2026
Data Engineering Fundamentals

Capstone: backfill and the run report

Final lesson of the module. A pipeline is not done when it runs — it is done when it survives reality: a source outage, a bug discovered three days later, a request for last month's data. Two last skills close the module: backfill (run the pipeline for a past window, safely) and the run report (prove what each run actually did).

The code

from datetime import date, timedelta

def backfill(start, end):
    day = start
    while day <= end:
        run_pipeline(day)        # Lesson 30's four stages, one day
        day += timedelta(days=1)

# The source was down Nov 2-6. The API is back — rebuild that week:
backfill(date(2026, 11, 2), date(2026, 11, 6))

In practice

Backfill is safe only because of everything before it. Bronze is partitioned by day, so one day rebuilds without touching others (Lesson 32). Loads are idempotent, so re-running a day replaces instead of doubling (Lesson 36). The quality gate re-checks rebuilt data before gold moves (Lesson 34). Remove any one of those and backfill becomes a way to corrupt history at scale.

Every run writes a report. Three numbers per stage tell you in seconds whether a run was healthy: rows in and rows out, the unmatched-station count from enrichment (Lesson 35), and the quality failures from the gate (Lesson 34). A run that 'succeeded' with zero rows in is not a success — it is an outage nobody noticed.

Alert on absence as loudly as on errors. Most pipeline disasters are silent: the scheduler stopped, the API returned empty pages, the gold table quietly aged. A daily check that gold's newest date is yesterday catches the failures that throw no exception.

Python bridge: The whole module was building the preconditions for this one small function: raw data kept, keys chosen, gates written, stages orchestrated. Backfill is the exam the design passes.

Further reading

DAG Runs — Apache Airflow documentation (the official DAG Runs page — its Catchup and Backfill sections are the orchestrator's version of this lesson)

Try it

Practice question: The NWS API was down Nov 19–20 and your bronze folders for those days are empty. A backfill over Nov 19–20 runs today, Nov 25. What does it produce for those two days — and which design decision from this module decides whether the answer is 'real data' or 'permanent gap'?

Show answer

Result: If the API still serves historical observations for those dates, ingest fetches them now and the pipeline treats them like any other days — because every layer is keyed and partitioned by the *observation* day, not the day the job ran. If the source has rotated those observations away, the gap is permanent: no downstream cleverness can rebuild data nobody saved. That is the entire argument for Lesson 32's bronze discipline — you can only backfill what somebody landed. And that completes the Geospatial Pipelines module: ingest, land, clean, gate, enrich, load incrementally, orchestrate, serve, and backfill — a geospatial pipeline designed end to end.

← All posts