Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
dbt Labs · dbt Analytics Engineering

Seeds and Snapshots

dbt Analytics Engineering · Lesson 6 of 17 · 41:44

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the dbt Analytics Engineering Certification exam. In this lesson: seeds for small reference data, snapshots configured in YAML, the timestamp and check strategies, the snapshot meta columns, and deleted rows with hard_deletes. Includes three original practice questions, with Orchardline Meal Kits, a fictional meal-kit company, as the example.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Overwritten plans, copied spreadsheets

Orchardline's subscriptions table only keeps each customer's current plan: when someone moves from the family box to the two person box, the old plan is overwritten. Finance now asks how many customers changed plans last quarter, and the delivery regions still live in a spreadsheet that each analyst copies by hand. This lesson covers seeds, snapshots in YAML, the timestamp and check strategies, and deleted rows.

Seeds

A seed is a CSV file in the seeds folder of your project, which dbt seed loads into the warehouse as a table. Because the file is stored in the repository, it is version controlled and code reviewable. Seeds suit small, static data that changes rarely, like country codes, delivery regions, or a mapping of plan codes to plan names. Models read a seed with ref, exactly like a model, and dbt infers the column types, unless you set column types in its configuration. But seeds are not a way to load raw data: large CSV exports load slowly, and belong to a real loading tool.

Snapshots in YAML

A snapshot keeps the history of a mutable table, as a type two slowly changing dimension. Since dbt 1.9, you define it in a YAML file: a name, a relation, which is a source or a ref, and a config with a unique key and a strategy. Each run of dbt snapshot compares the current rows with the snapshot table, closes the old version of a changed row, and adds the new version. Meta fields describe each version: dbt valid from and dbt valid to give its validity period, and dbt valid to stays null for the current version, unless you set dbt valid to current. A snapshot cannot be rebuilt, since the past is gone, so it ignores the full refresh flag, and it belongs in a separate schema.

Timestamp and check strategies

The timestamp strategy is the recommended one: it compares an updated at column with the last run, and adds a new version when that timestamp is more recent. It also copes better with added and removed columns than the check strategy. The check strategy is for tables without a reliable updated at column: it compares a list of check columns, or all columns, between the current and the historical values. Listing the columns explicitly is better than all, and a surrogate key can condense many columns into one. Either way, the unique key must really be unique, so add a uniqueness test on the source.

Deleted rows and good practices

When a row disappears from the source, the hard deletes config decides what happens. With ignore, the default, the snapshot does nothing, and the last version stays current. With invalidate, dbt closes the deleted row, by setting its dbt valid to. With new record, dbt adds a row with dbt is deleted set to true, and a restored record comes back as another new row. And to snapshot transformed data, like filtered or deduplicated rows, point the relation at an ephemeral model, rather than at the raw table.

Recap

Let's recap. Seeds load small, static CSV files as tables, read with ref, and never large raw exports. Snapshots keep the history of changing rows, defined in YAML with a relation, a unique key, and a strategy. The timestamp strategy is recommended, and the check strategy compares listed columns when no timestamp exists. The hard deletes config handles deleted rows: ignore, invalidate, or new record. And a snapshot cannot be rebuilt, so keep it in its own schema.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Orchardline exports two million rows of order history every night as a CSV file. A developer wants to put it in the seeds folder and load it with dbt seed. What is the best advice?

    • Fine, since dbt seed loads CSV files of any size
    • Split the export into ten smaller seed files
    • Set column_types on the seed so that it loads faster
    • Load it with a loading tool, then declare a source
    Show the answer

    Load it with a loading tool, then declare a source

    Seeds are for small, static reference data, so a large nightly export belongs to a loading tool, and then to a source. “Fine, since dbt seed loads CSV files of any size” is wrong, since loading large files with dbt seed performs poorly. “Split the export into ten smaller seed files” would only spread the same slow load over ten files. And “Set column_types on the seed so that it loads faster” is wrong, since column types control how values are typed, not how fast a large file loads.

  2. The recipes table has no column that shows when a row last changed, but chefs often edit the price and the cooking time. Which snapshot configuration fits?

    • strategy: timestamp, updated_at: recipe_id
    • strategy: check, check_cols: [price, cook_minutes]
    • strategy: timestamp, with no updated_at
    • Reload a seed of the recipes every night
    Show the answer

    strategy: check, check_cols: [price, cook_minutes]

    Without a reliable timestamp, the check strategy compares the listed columns, and adds a version when one of them changes. “strategy: timestamp, updated_at: recipe_id” is wrong, since a recipe ID does not tell dbt when a row changed. “strategy: timestamp, with no updated_at” is wrong, since the timestamp strategy requires an updated at column. And “Reload a seed of the recipes every night” is wrong, since a seed reloads a file, and keeps no history at all.

  3. Customers who cancel are deleted from the subscriptions table. Analysts must see, in the snapshot, an explicit row that marks each deletion. Which setting fits?

    • hard_deletes: ignore
    • hard_deletes: invalidate
    • hard_deletes: new_record
    • invalidate_hard_deletes: false
    Show the answer

    hard_deletes: new_record

    New record adds a row with dbt is deleted set to true, so each deletion is explicit. “hard_deletes: ignore” is wrong, since ignore does nothing, and the deleted row stays current. “hard_deletes: invalidate” is wrong, since invalidate only closes the row, with no row that marks the deletion. And “invalidate_hard_deletes: false” is wrong, since that older setting is replaced by hard deletes, and false would ignore deletions anyway.