Module 9 of 16

Incremental Models and Backfills

Scale transformations without losing correctness when old data changes.

Updated

120 minutes1 exercisesFree

Start here

Learning objectives

  • Understand full refresh vs incremental builds
  • Handle late-arriving data
  • Reason about backfills and idempotency
Incremental Models and Backfills Follow the arrows. Each box is one idea you will practice in this module. Full run step 1 New rows step 2 Late data step 3 Backfill step 4 Verify step 5 Production analytics engineering turns raw records into governed, trusted business meaning.

The Mental Model

Incremental models process only new or changed data to reduce cost. The hard part is correctness when data arrives late or historical logic changes.

Instead of rewriting an entire notebook every day, you add only today's pages. But if yesterday's page was corrected, you need a way to update it.

Dataset reference: ecommerce tables and grain assumptions.

Catch a late update without duplicating an order

Order 101 has created_at = Monday and source_updated_at = Wednesday. A Wednesday load filtered only by created_at misses the update. The processing cursor and business event timestamp serve different purposes.

Existing target: order 101, amount 100, updated Monday
Incoming batch:  order 101, amount 80, updated Wednesday
Required target: order 101, amount 80, one row only

Choose a reliable source update timestamp, an overlap window, and an adapter-supported merge or replacement strategy keyed by order_id. The unique_key setting identifies matching rows; it is not a database uniqueness test. Handle deletes explicitly and run a backfill for corrections older than the overlap window. Exact incremental syntax depends on the warehouse and adapter; see dbt incremental models.

Acceptance check: process the same batch twice, then process an older correction. Verify one final row per order and reconcile against a full rebuild on the same source snapshot.

Interactive Check

Question: An order from Monday arrives in the source on Wednesday. What can go wrong in a naive incremental model?

Reveal the answer

The model may only process Wednesday rows and miss the Monday order because its event timestamp is old. Use a lookback window or update timestamp strategy.

Practice: Spot the Incremental Bug

Read a naive incremental filter and explain why it misses late-arriving data.

Use the guided lab below to record your result, assumptions, and the check that would catch an incorrect result.

Production notes

Keep these close

  • Document the backfill procedure before you need it. Emergency backfills are risky when no one knows the intended path.

Common mistakes

What usually breaks

  • Filtering only by event date
  • Skipping deduplication after lookback windows
  • Using incremental models before the logic is stable

Key terms

Vocabulary used in this module

Incremental model

A model that updates only a subset of rows instead of rebuilding everything.

Backfill

A controlled rebuild or correction of historical data.

Exercises

Practice inside the lesson

30-45 minutesBeginner to Intermediate

Spot the Incremental Bug

Read a naive incremental filter and explain why it misses late-arriving data.

  1. Identify the event timestamp
  2. Identify the load timestamp
  3. Explain which timestamp the filter uses
  4. Add a 3-day lookback window
  5. Describe how to deduplicate after the lookback

Expected evidence

A short answer, SQL/YAML snippet, or lineage map that can live directly in the course page notes.

Recap

Key takeaways

  • Incremental models are performance tools with correctness risks
  • Late-arriving data must be designed for explicitly
  • Backfills should be repeatable and reviewed

Related resources

Keep learning across CodersSecret