# dbt Snapshot

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

**Field:** Data Engineering  
**Category:** Processing  
**Also known as:** dbt Snapshots

## Think of it like

It is like a height chart on a door frame. Each new mark is added, and the old marks stay.

## Definition

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.

## Example code

```yaml
snapshots:
  - name: orders_snapshot
    relation: source('shop', 'orders')
    config:
      unique_key: id
      strategy: timestamp
      updated_at: updated_at
```

This uses the timestamp strategy. A row counts as changed when its updated_at time moves on.

## Why it matters

Many source tables overwrite old values. Without a snapshot, the past is gone for good.

## Common mistake

Running it too rarely. A row that changes twice between runs keeps only the last change.

## Three principles

- **Never overwrite.** A change adds a row.
- **Valid from and to.** Each version has its own dates.
- **Run on a schedule.** Only changes seen at a run are kept.

## Related terms

- [dbt (Data Build Tool)](https://learn.benibix.com/term/data/dbt)
- [Slowly Changing Dimension (SCD)](https://learn.benibix.com/term/data/slowly-changing-dimension)
- [Incremental Model (dbt)](https://learn.benibix.com/term/data/incremental-model)
- [dbt Source](https://learn.benibix.com/term/data/dbt-source)
- [Data Vault](https://learn.benibix.com/term/data/data-vault)

## Told apart from

- [dbt Snapshot vs Incremental Model](https://learn.benibix.com/compare/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.

![A dbt project from left to right. A source, the raw table shop.orders loaded by other tools, feeds a model called stg_orders, a SELECT that cleans it. That feeds a highlighted incremental model called orders, where each run adds only the new rows. Under it, tests check that order_id is unique and not null, find 0 failing rows and pass. Under the source, a snapshot called orders_snapshot keeps each old version with valid from and to dates.](https://learn.benibix.com/diagrams/dat-dbt-project.svg)

---

Source: https://learn.benibix.com/term/data/dbt-snapshot
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
