Run the dbt warehouse tests starter end to end
Clone the dbt-warehouse-tests starter, seed its deterministic customers and orders data, and build the staging → intermediate → marts pipeline with dbt build --target dev. You serve the docs, add the tests that protect the fct grain, and finish against the failure scenarios the project warns about.
At a glance
| When | Standing up a tested, documented star schema from raw landed data; A template for gating dbt changes on data-aware CI |
|---|---|
| Where | dbt |
| Why | The starter only protects you if you actually run its seed, build, tests, and CI gate against a real target. |
Learning objectives
- Layer staging, intermediate, and marts models
- Run the seed/build/docs loop the starter ships with
- Enforce unique + not_null on the fact grain key
What you need
- The dbt-warehouse-tests starter repo
- A Postgres or DuckDB dev target
- dbt installed (dbt deps, dbt seed)
Steps
- dbt deps && dbt seed (from project-dbt-warehouse-tests )
- dbt build --target dev (from project-dbt-warehouse-tests )
- dbt docs generate && dbt docs serve (from project-dbt-warehouse-tests )
- Write tests that protect the grain. (from project-dbt-warehouse-tests )
- unique + not_null on the fct grain key (from project-dbt-warehouse-tests )
- relationships from fct to dims (from project-dbt-warehouse-tests )
Check yourself
- dbt build --target dev finishes with every test passing and docs render for the full DAG.
- The fct_orders grain key carries unique + not_null, and relationships link fct to dims.
Worked example
Seed, build, and serve the starter — from project-dbt-warehouse-tests
dbt deps && dbt seed
dbt build --target dev
dbt docs generate && dbt docs serve
Tests that protect the fct_orders grain in schema.yml — from project-dbt-warehouse-tests
# models/schema.yml - tests + descriptions on every node
models:
- name: fct_orders
columns:
- name: <grain key> # unique + not_null on the fct grain key
tests:
- unique
- not_null
- name: <fk column> # relationships from fct to dims
tests:
- relationships:
to: ref('<dim model>')
- name: status # accepted_values on status
tests:
- accepted_values:
values: [<allowed statuses>]
Sourced from
Security scan
Last sweep 2026-10-24: 0 finding(s), 0 marked as examples.
Common gotchas
- Late-arriving order missed → lookback window too short.
- Grain key not unique → a join fanned out upstream.
- CI green but prod differs → CI ran on a different target/schema.
Production considerations
- CI builds to a per-PR staging schema and runs full tests.
- Declare source freshness checks on raw and exposures for dashboards.
Diagram
starter run
|
|- dbt deps && dbt seed --> dbt build --target dev
|
|- staging --> intermediate --> fct_orders --> marts
|
|- unique + not_null on grain --> relationships to dims --> docs + CI
Registry stats
| Verification | community · Oct 21, 2026 |
|---|---|
| Completeness | 81 |
| Trust multiplier | ×1.25 |
| Composite | 34.15 · adequate |
| Freshness | 3 days since last source check |
| Difficulty | beginner |
| Version | 0.1.0 |
| License | CC-BY-4.0 |
| Security flags | none |
Did this solve your problem?
Run the dbt warehouse tests starter end to end