Skip to content
BENIBIX Learn

dbt Snapshot vs Incremental Model

People think a dbt snapshot and an incremental model do the same job, since both add rows to a table over time. An incremental model adds new rows to save time, and a changed row can replace the old one. A snapshot is there to keep history. A changed row is added as a new version, and the old one stays. Use a snapshot when you need to know what a value used to be.

Data⚙️ Processing

dbt Snapshot

A dbt table that keeps each old version of a row that changes.

A dbt snapshot keeps the history of a table whose rows change in place. Each time dbt snapshot runs, it compares the table with the last run. When a row has changed, it closes the old version and adds the new one. Two columns, dbt_valid_from and dbt_valid_to, say when each version was true. This builds a type 2 slowly changing dimension.

Example
An order goes from pending on 1 January to shipped on 2 January. The snapshot keeps both rows, each with the dates it was true.
Why it matters
Many source tables overwrite old values. Without a snapshot, the past is gone for good.
Full entry
Data⚙️ Processing

Incremental Model (dbt)

A dbt model that adds just the new rows on each run.

An incremental model is a dbt model that adds only new or changed rows on each run. The first run builds the whole table. Later runs use the is_incremental() check to pick just the new rows and add them. This is much faster than rebuilding a big table every time. The --full-refresh flag rebuilds it from scratch.

Example
An events table has 2 billion rows and gets 5 million a day. The incremental model adds the 5 million in minutes instead of rebuilding all of it.
Why it matters
Big tables would take hours and cost a lot to rebuild each night. Adding only new rows keeps runs short and cheap.
Full entry

In one line

dbt Snapshot
A dbt table that keeps each old version of a row that changes.
Incremental Model (dbt)
A dbt model that adds just the new rows on each run.