Backfills are where careful engineers cause incidents: reprocessing three months of partitions touches every downstream consumer, competes with production for warehouse capacity, and — done in the wrong order — writes wrong data at scale.
Tier: Foundation · Workflow area: Orchestration, ops & cost
The knowledge needed to plan one well (dependency order, partition math, cost estimation, what to check before and after) is exactly the kind of structured reasoning an LLM drafts well from your inputs. This playbook produces a reviewable backfill runbook: partition ranges, dependency-ordered execution, cost estimate, blast-radius checks, and an abort plan.
For a single-partition rerun of one task, just rerun it — a runbook for one click is ceremony.
Gather the four inputs. (a) The change: what was wrong, what's fixed, which models are affected. (b) The affected date range and partition grain. (c) The dependency subgraph (dbt ls --select fixed_model+ --output json, or your DAG's task graph). (d) Operational constants: rough cost/runtime per partition per model (from recent runs), warehouse capacity windows, freshness SLAs of affected consumers.
Prompt for the runbook, demanding the checks.
Draft a backfill runbook from the attached inputs (change description,
dependency subgraph, partition grain and range, per-partition runtime/cost stats).
Structure:
1. Scope: exact models and partition range; explicitly list what is OUT of scope.
2. Preconditions: fix deployed & verified on one partition; snapshot/backup of
affected partitions where the store supports it; downstream consumers notified.
3. Execution plan: dependency-ordered waves; within each wave, chunked partition
ranges sized so one chunk finishes inside our capacity window. State the exact
command per chunk (Airflow 3 backfill via UI/CLI or dbt build --select
<model> --vars with partition variables).
4. Cost & duration estimate per wave, from the attached per-partition stats;
flag if total exceeds <budget>.
5. Blast-radius checks: before/after row counts and one domain metric per model
per chunk; a canary partition validated fully before proceeding to bulk.
6. Abort/rollback plan: how to stop mid-wave, what state that leaves, how to
restore from snapshot.
Do not invent runtime numbers — derive only from the attached stats and show
the arithmetic.
Expected output: a runbook where every number traces to your stats and every wave has a check gate. The "show the arithmetic" rule makes the cost section auditable instead of decorative.
Review the two things LLMs get wrong here. Dependency order (verify each wave's models depend only on earlier waves — diff against dbt ls output) and idempotency assumptions (the runbook assumes delete-insert/MERGE semantics; confirm each affected model actually has them — an append-only model in the list converts the backfill into a duplication engine).
Run the canary, then the waves. Execute exactly one partition end-to-end, run the blast-radius checks, and get an explicit go/no-go with a named approver. Then proceed wave-by-wave with Airflow 3's backfill (the 3.x backfill UI/API makes chunked ranges first-class), checking gates per chunk. Late-night capacity windows come from the runbook, not from improvisation at 11 p.m.
Close out with evidence. The completed runbook — with actual counts, actual costs, and check results pasted in — becomes the incident/change record and the template for the next backfill. Store it with the code change, not in someone's DMs.
The canary partition is the go/no-go gate for the whole backfill. One partition, full validation, named approver — bulk reprocessing under a bug you haven't proven fixed is how one incident becomes two.
state: / graph operators)mechanical source of the dependency subgraph and per-wave build commands.A backfill runbook contains schema names, cost figures, and incident context — all client-confidential, none of it needed by an external model if you abstract it: placeholder model names and relative cost units in the prompt, real identifiers substituted inside the client's environment. If even that is disallowed, use the runbook structure above as a manual template — the section list is the transferable asset. For consultancies, the closed-out runbook with evidence pasted in is exactly the artifact clients expect from a controlled change; delivering two of these tends to make the client's own team adopt the format.