dbt Incremental Backfills: Repair History Without Breaking Today's Reports
A reliable dbt backfill identifies the affected business records or time periods, recomputes their complete results, and replaces the appropriate target state. It also checks downstream models and activation jobs. Simply widening a date filter can miss old corrections, overwrite a daily total with a partial total, or leave duplicate rows behind.
On this page
Marketing data rarely becomes final the moment it arrives. Ad spend can change, refunds arrive after purchases, and a corrected campaign mapping can alter months of reporting. Incremental processing saves work, but only if the model knows which earlier results those changes invalidate.
This guide is for the data engineer or analytics owner who needs a repeatable repair procedure. The examples are illustrative and use small fixtures so the expected result is visible. Apply the pattern to your adapter, model grain and retention policy before using it in production.
If historical reporting repeatedly disagrees with source systems, our warehouse implementation service can help separate ingestion completeness, transformation logic and business definitions. A faster incremental job will not resolve a disagreement about what revenue means. For the dbt models themselves, see our dbt implementation services.
What are you actually trying to repair?
Classify the incident and confirm the source history before choosing a command. The repair must preserve the business meaning of the marketing warehouse these models feed:
- Late arrival: a previously unseen event belongs to an older business date.
- Correction: an existing record has changed, perhaps through a refund or revised cost.
- Logic change: the same source rows now produce a different result.
- Missing history: the warehouse never retained the source records needed for reconstruction.
- Deletion: a record must be removed or its contribution reversed.
The first three can often be repaired from retained data. The fourth requires recovery from an upstream source or a clear statement that the historical result cannot be reconstructed. A full refresh cannot recreate information that no longer exists.
Write the repair objective in business terms. For example: “Recalculate campaign-day net revenue for 1 to 7 October using the corrected refund mapping, while leaving all other periods unchanged.” That is much easier to validate than “rerun the revenue model.”
The late-arriving marketing data guide explains how to separate event time from arrival time. Keep both when possible: one assigns the business period and the other helps identify new information.
Why can a recent-date filter miss an old correction?
An incremental model processes the source rows selected by its SQL. dbt does not infer every historical dependency from a business rule. The model must remain valid on both its initial-build and incremental paths. Configure incremental models
Imagine an order dated 3 October receives a correction on 14 October. Filtering only for orders dated after 13 October excludes it. Filtering by a reliable change timestamp could find the correction, but you still need to know which output rows it affects.
For an order-grain model, that may be one order. For a campaign-day aggregate, it may be the entire 3 October campaign group. For a cumulative lifetime-value model, it may affect later snapshots too.
A rolling lookback is an operational compromise. It covers changes inside its window, not every possible correction. Measure the distribution of actual delays and maintain a separate process for older repairs. Do not label a seven-day lookback “complete” unless the upstream contract genuinely guarantees that boundary.
Use a successful-run watermark rather than advancing a cursor merely because a job started. If a job fails after reading the input but before publishing the output, the next attempt must still include the unfinished work.
Why must you recompute the entire affected group?
A replacement-style aggregate needs all the records contributing to the affected group. Newly arrived rows tell you where to recompute; they do not necessarily contain the complete replacement result.
Hypothetical example, in USD for the 3 October business date. The fixture contains one accepted row per order and no mixed currencies.
| Stage | Orders included | Revenue USD | Interpretation |
|---|---|---|---|
| First report | A and B | 150 | USD 100 plus USD 50 |
| Late arrival only | C | 40 | New information received on 14 October |
| Correct replacement | A, B and C | 190 | Complete affected business date |
| Incorrect replacement | C alone | 40 | Earlier USD 150 disappears |
The repair has two stages: identify affected dates from arrivals, then read all retained orders for those dates at the chosen cutoff. This simplified SQL assumes an append-only fixture, unique order rows and UTC ingestion timestamps. net_amount holds USD major units here; use a documented fixed-precision or minor-unit representation in production.
The arrival window is 14 October up to, but excluding, 15 October 2026. The same upper cutoff prevents later arrivals from leaking into the reconstructed result:
with affected_days as (
select distinct order_date
from orders
where ingested_at >= '2026-10-14 00:00:00'
and ingested_at < '2026-10-15 00:00:00'
),
recomputed as (
select
o.order_date,
count(*) as order_count,
sum(o.net_amount) as net_revenue
from orders o
join affected_days d
on o.order_date = d.order_date
where o.ingested_at < '2026-10-15 00:00:00'
group by o.order_date
)
select * from recomputed;The expected output is three orders and USD 190 for the affected date. Validate the query with the synthetic rows, including a future arrival and an unaffected date. A different unaffected date should not be included. This query discovers and recomputes the repair set; the adapter-specific materialization must then replace or update the appropriate target rows.
For a campaign-day model, discover and recompute both parts of the key. For mutable records, use a trustworthy change indicator and retain enough previous state to identify the old group as well as the new one. If an order moves from one campaign to another, repairing only its new campaign leaves its old contribution behind.
A group that becomes empty needs explicit handling too. An aggregate query returns no row for a group with no remaining members. A merge cannot update a target row it never receives. Your repair design must deliberately remove that old group or write an agreed zero result.
A historical repair needs retained source data and complete replacement groups, not just a wider filter. Validate empty groups, target matching, unchanged periods and repeat execution before releasing the result through each consumer’s agreed path.
Read diagram as text
- Bound the repair keys dates and source cutoff to Retained history can reconstruct the result?.
- Retained history can reconstruct the result? to Recover source history or report the coverage gap: No.
- Retained history can reconstruct the result? to Recompute complete old and new affected groups: Yes.
- Recompute complete old and new affected groups to Empty groups and target matching handled correctly?.
- Empty groups and target matching handled correctly? to Correct the strategy or match predicates: No.
- Correct the strategy or match predicates to Recompute complete old and new affected groups.
- Empty groups and target matching handled correctly? to Totals unchanged periods and repeat-run checks pass?: Yes.
- Totals unchanged periods and repeat-run checks pass? to Isolate the failed result and repair the calculation: No.
- Isolate the failed result and repair the calculation to Recompute complete old and new affected groups.
- Totals unchanged periods and repeat-run checks pass? to Release through each consumer's agreed repair path: Yes
How should you choose the incremental strategy?
Choose the strategy by the replacement unit and the failure cases, then confirm adapter support. Warehouse design that plans for reruns defines the grain and retained state those choices depend on. Append adds the selected rows without deduplicating existing target records. Merge uses its match condition to decide between updates and inserts. Partition-oriented strategies replace a different unit of data. Inspect the compiled SQL for your actual adapter rather than assuming the strategy names behave identically everywhere. Incremental strategies
Building the model for the first time? The dbt incremental model guide covers the initial build, update key and acceptance tests before a historical repair is needed.
Use this decision table with the current adapter-specific strategy documentation. The verification column is an implementation requirement, not a vendor guarantee.
| Repair unit | Candidate approach | What must be true | Test before release |
|---|---|---|---|
| Individual current record | Supported merge/update strategy | Stable key and resolved source version | Old key updates rather than duplicating |
| Complete day or partition | Supported partition replacement | Query returns the complete intended partition | Existing rows survive unless deliberately removed |
| Bounded time-series batches | Microbatch where supported | Event-time setup and batch semantics fit the model | Boundary, empty batch and rerun behaviour |
| Most historical output | Deliberate full rebuild | Source history is recoverable and cost acceptable | Independently expected full result |
For row-level repairs, define the stable business key and decide how source duplicates are resolved. For partition replacement, make sure the replacement query contains the complete intended partition. Replacing a day with only its late arrivals destroys the rest of that day's result.
Do not confuse unique_key configuration with a data-quality test. The configuration supplies matching information; your source and target still need checks for nulls and duplicate keys. Unique key reference
How can target pruning break an old correction?
Some performance configurations add a time restriction to the destination side of a merge. If an incoming correction is older than that restriction, its existing target row may be invisible to the match. Depending on constraints and adapter behavior, the operation can attempt an insert instead of updating the old row. This follows from the merge condition shown in dbt's strategy documentation; it is not a separate deduplication guarantee.
Review both the source filter and the target match predicate. A repair that widens only the source side can still be wrong. Test with an old existing key, not only a new key whose insertion would succeed under either configuration.
When is a full refresh appropriate?
A full rebuild is a sensible option when the retained source is complete, the model is affordable to reconstruct and the change affects most historical results. For a narrow correction in a large model, a bounded repair may be more practical.
Before rebuilding, record the expected output grain, historical coverage, source cutoff, code version and downstream consumers. Estimate what a large backfill scans and costs when BigQuery is the target. Avoid rebuilding against a moving or partially loaded source without a defined consistency boundary.
The resource's full_refresh setting overrides the command-line flag. A model configured with false will not become a full refresh merely because the command includes --full-refresh. Snapshots have separate behavior and are not recreated by that flag. Full refresh configuration
For a conventional incremental model that permits rebuilding, the following command selects one example model. Confirm its target environment and effective configuration before running it:
dbt build --full-refresh --select fct_campaign_dayThis example names one model. Review the lineage and select affected downstream models deliberately. Adding a broad descendant selector without reviewing what it contains can enlarge the operation substantially.
A schema change is not a historical calculation repair. dbt documents that on_schema_change options do not backfill old rows for a newly added column. If the column must be populated historically, schedule that work explicitly and validate coverage. Schema change behavior
Keep a recoverable prior result or rebuild into an isolated relation where your platform supports that workflow. The exact promotion and rollback mechanism depends on the warehouse. The acceptance decision should happen before the revised data starts driving customer-facing actions.
When does microbatch help?
Microbatch is designed for time-series workloads and is available from dbt v1.9, subject to adapter support. It divides work by event_time and batch size; upstream references need appropriate event_time configuration to be automatically filtered. An unfiltered parent can be scanned for every batch. The documented time inputs use UTC. Microbatch documentation
For a model already configured correctly for microbatch, a bounded example is:
dbt build --select fct_activation_events \
--event-time-start '2026-10-01' \
--event-time-end '2026-10-08'Both boundaries are required. The intended UTC interval starts on 1 October and ends before 8 October; verify that the generated day batches cover 1 through 7 October in the chosen runtime. Inspect the generated batches and adapter requirements before execution. A configured lookback handles a limited recent range; older repairs still need an explicit range.
Do not automatically filter every dimension by the event's date. A current account classification and a historical event may need to join across different time meanings. Conversely, if the report requires the classification as it was at the event time, a current-state dimension is insufficient.
Microbatch improves how bounded work is organized. It does not decide whether your campaign attribution rule, historical dimension join or revenue definition is correct. That remains part of the model contract.
What must the validation prove?
Validation must establish correct changed groups, unchanged unaffected groups and safe repeat execution. Start with structural tests, then add business reconciliation. dbt supplies generic tests for uniqueness, non-null values, accepted values and relationships, while custom tests can return rows that violate your own assertions. Data tests
For the daily revenue repair, useful acceptance checks include:
- The affected date contains three orders and USD190 in the fixture.
- Unaffected periods are unchanged.
- The output key remains unique and non-null.
- The old and new totals differ by the independently calculated correction.
- Running the same repair twice with identical input produces the same final result.
- A source deletion or group reassignment has the intended old-group effect.
Compare at several levels. A matching overall total can hide amounts assigned to the wrong campaigns. Reconcile totals, group counts and selected record identities. For money, use a documented currency and rounding policy instead of comparing mixed currencies as if they were one measure.
The dbt implementation troubleshooting guide supplies a full-versus-incremental comparison and explains its uniqueness prerequisites. Keep this backfill check focused on the affected history. Test the incremental path as well as the initial build. dbt's continuous integration (CI) guidance explains why a clean schema can exercise only the initial-build path and miss a failure that occurs when a production table already exists. Cloning an appropriate existing model is one documented approach where supported. Testing existing incremental state in CI
How do you keep a backfill from triggering unwanted campaigns?
Give each downstream consumer an explicit release condition before starting the repair. A corrected warehouse attribute can flow into a CRM or lifecycle tool as soon as activation resumes. Historical event replay can also look like new activity to a downstream system.
List the consumers before repair: dashboards, exports, audiences, event feeds and automated decisions. Decide whether each should see the correction immediately, after validation, or through a special historical-repair path.
The Hightouch implementation guide explains why repeating a sync is not a universal recovery action. Preserve that distinction when a dbt backfill supplies its source data.
Checklist
- The repair has a named owner, reason and bounded scope.
- Required historical source data is present and complete enough to rebuild.
- Source selection and target matching cover the same affected records.
- Complete groups or partitions are recomputed, including empty-group handling.
- Old and new group identities are covered when records move.
- Adapter, runtime and effective model configurations are recorded.
- Expected numerical differences are calculated independently.
- Initial-build, incremental and repeat-run behavior have been exercised.
- Downstream reporting and activation consumers have a release plan.
- The accepted result and recovery evidence are retained.
Finally, document whether the repair changes the definition of the metric or merely corrects its implementation. The marketing metric contracts guide helps make that distinction visible to people reading the reports. A number that changes without an explanation can undermine trust even when the new number is correct. For a bounded repair, request a warehouse backfill scope with the affected dates, model and expected difference. Bring an unclear historical discrepancy to the $99 martech audit.
Keep reading
Browse all Data Warehouse guides
Data Warehousedbt Tests for Marketing Data: 12 Checks With SQL and YAML Examples
Build a dbt test suite for spend, CRM and billing data. Copy SQL and YAML examples, catch missing rows, set severity and prove the release gate works.
Jafrin Akter AloLast updated 12 min read
Data WarehouseHow to Handle Late-Arriving Marketing Data and Retroactive Corrections
Handle late events and retroactive corrections across GA4, Google Ads, Mixpanel and Stripe, with a versioned ledger, source limits and safe backfills.
Jafrin Akter AloLast updated 15 min read
Data Warehousedbt Implementation Mistakes: Fix Stale Models, Incremental Errors and Fragile Deployments
Fix stale dbt models, incremental errors, schema backfills and fragile deployments with practical tests, build-cost checks and a reliable handover plan.
Jafrin Akter AloLast updated 15 min read
dbt implementation
See the implementation scope, deliverables and acceptance checks.
Questions people ask
What should a backfill approval record contain?
Record the business reason, affected keys and dates, source cutoff, model version, expected difference, cost estimate and release owner. Include the prior result or its recovery location and the consumers that must wait. The approval should identify the exact repair, not grant general permission to rebuild every model that happens to depend on the same source.
What if the source changes while a backfill is running?
Use a consistent snapshot or explicit cutoff that your source and warehouse can support. Preserve enough evidence to distinguish the repair's input from later changes. If the source cannot reproduce that boundary, document the limitation and reconcile again before publishing. A finished query does not prove that all batches read the same business state.
Will a full refresh restore deleted source history?
No. A rebuild can only transform the information available to its query. Recover missing history from an authorised retained source if one exists, or expose the coverage gap in the result. Do not populate absent history with guessed values merely to make a column look complete. Record which periods and measures remain unavailable after the repair.
How do I know that a repair is safe to rerun?
Run it twice against the same controlled input and compare final keys, values and totals. Include an empty affected group and a record moving between groups, because both can leave obsolete output behind. Inspect downstream effects separately: an unchanged warehouse table does not prove that repeated event delivery, customer messaging or task creation would be harmless.
Should a backfill always include every downstream model?
Include consumers whose stored results depend on the repaired data or logic, with a release path appropriate to each. Review lineage, materialization and external dependencies before selecting them. A view can expose new base data immediately, while a stored aggregate needs rebuilding and an activation destination needs its own validation. A broad descendant selector is only a starting inventory.
Sources

Written by
Jafrin Akter AloData Engineer and Co-founder at Martechdevs and Growth and Analytics Partners
Jafrin writes practical guides to marketing technology, customer data, analytics and AI workflows. Martechdevs is a Growth and Analytics Partners company.