What a dbt snapshot records
Snapshots let dbt keep a history of how a row changes over time. Normally, updating a source row replaces its previous values. A snapshot keeps successive versions of that row, so you can see what was true at different times.
Start with one customer
Suppose customer 7 currently has the status active. The source stores one row for this customer, with customer_id = 7 and status = active.
One source row, two historical versions
- 09:00 · first snapshot run
customer_id=7 · status=activeThe snapshot saves the active state.
- 11:00 · snapshot runs after the update
customer_id=7 · status=pausedThe source now holds paused. The snapshot keeps both versions.
customer status period
7 active 09:00–11:00
7 paused 11:00 onwardThe source still has one current row. In a separate table, the snapshot keeps both versions of customer 7, each for a different period. This is SCD Type 2: a type 2 slowly changing dimension.
Follow the record through the system
Next, we'll run the snapshot several times and watch what happens as this source row changes.
History must be captured before it disappears
A view or rebuilt table reads the source as it is now; an incremental merge normally updates its saved row. None automatically retains every earlier version. A snapshot cannot recover a value overwritten before its first capture.