Test dbt Models Locally With DuckDB and Generated Seeds
You can run a whole dbt project on your laptop in a minute: DuckDB is the database, seeds are the data, and nothing touches your warehouse. Here is the full setup, using test data generated from your own project.
1. Get the seeds
Load your project in SQL Project Lineage, open the **Test data** tab and download the ZIP. Copy the CSV files into `seeds/`.
2. Install dbt-duckdb
pip install dbt-duckdb3. Add a DuckDB profile
# profiles.yml (use the profile name from your dbt_project.yml)
jaffle_shop:
target: dev
outputs:
dev:
type: duckdb
path: dev.duckdb
threads: 44. Point sources at the seeds
Seeds load into your target schema (or the schema your project sets for seeds). If your models use source(), set the source schema to it while testing:
sources:
- name: ecom
schema: "{{ target.schema }}"The README in the ZIP has this YAML already filled in for your sources, and says when your project has its own generate_schema_name macro.
5. Run
dbt deps # if you have packages.yml
dbt seed
dbt buildIf a test fails
- **not_null on a total**: a parent row has no child rows. The generator avoids this, but hand-edited seeds can bring it back.
- **expression_is_true across tables**: random data cannot know your business rule. Edit a few rows, or exclude the test while you develop.
- **Missing column**: add it to the CSV. Columns built only from Jinja that is not visible in the SQL cannot be detected.
Also try
How to use the SQL Project Lineage: step by step
- Download seeds from the Test data tab
- pip install dbt-duckdb and add the profile
- Point sources at the seed schema
- Run dbt seed and dbt build
When to use the SQL Project Lineage
- Developing dbt models offline
- Running dbt build in CI without a warehouse
- Reviewing a pull request locally
- Learning dbt on a real project