dbt build Command: Running Models, Tests, and Snapshots in One Go
Running dbt seed, then dbt snapshot, then dbt run, then dbt test as four separate commands works, but it has a real gap: nothing stops a broken model from being fully built and then having its downstream dependents build on top of it, before the test that would have caught the problem ever runs. dbt build closes that gap by interleaving every resource type โ seeds, models, snapshots, and their tests โ in a single dependency-ordered execution.
What Makes dbt build Different From Separate Commands
# The older pattern โ four separate passes over the DAGdbt seeddbt snapshotdbt rundbt test
# vs. one interleaved passdbt buildThe critical difference isnโt convenience โ itโs failure containment. With separate commands, dbt run builds the entire DAG before dbt test gets a chance to flag that stg_orders produced bad data; every model downstream of stg_orders has already built on top of the bad data by the time testing happens. With dbt build, if stg_orders fails its tests, dbt stops before building anything downstream of it in the same run.
1 of 12 START sql table model staging.stg_orders ........ [RUN]1 of 12 OK created sql table model staging.stg_orders .... [SELECT 48213 in 1.1s]2 of 12 START test unique_stg_orders_order_id ............ [RUN]2 of 12 FAIL 3 unique_stg_orders_order_id ................ [FAIL 3 in 0.4s]3 of 12 SKIP relation model core.customer_orders ......... [SKIP]4 of 12 SKIP relation model marts.sales_summary .......... [SKIP]Models 3 and 4 are marked SKIP โ dbt recognized that they depend (directly or transitively) on the model that just failed its test, and declined to build on top of known-bad data.
Selection Works Identically to dbt run
dbt build --select stg_orders+dbt build --select tag:financedbt build --exclude resource_type:snapshotThe same graph selection syntax covered in dbt run applies directly โ dbt build is a superset of what dbt run does, not a different selection model.
When Separate Commands Are Still the Right Choice
dbt buildโs all-in-one nature isnโt always what you want. Snapshots, in particular, are usually excluded from CI/PR validation runs entirely, as covered in dbt snapshot, since running them against an ephemeral CI database either fails outright or pollutes history with test data.
# A common CI pattern: build everything except snapshotsdbt build --exclude resource_type:snapshot
# Production job: snapshots run separately on their own schedule, before the main builddbt snapshotdbt build --exclude resource_type:snapshotSeparate commands are also more useful during fast local iteration, where you might genuinely want to build a model without immediately re-running its (possibly slow) downstream tests every single time you save a file.
Failure Modes: โfail-fast
By default, dbt build continues processing independent parts of the DAG even after a failure elsewhere, skipping only what actually depends on the failed node. --fail-fast changes this to stop the entire run immediately at the first failure.
dbt build --fail-fastThis trades thoroughness (seeing every failure in one run) for speed (stopping immediately rather than continuing to process unrelated, unaffected parts of the DAG) โ useful in a fast local feedback loop, less useful in a scheduled production job where you generally want the full picture of what broke.
Reading a Mixed-Resource-Type Run
A dbt build run against a project with seeds, models, snapshots, and tests shows all of them interleaved in dependency order, not grouped by type:
1 of 24 START seed country_region_mapping ................ [RUN]1 of 24 OK loaded seed country_region_mapping ............ [INSERT 12 in 0.3s]2 of 24 START snapshot customers_snapshot ................ [RUN]2 of 24 OK snapshotted customers_snapshot ................. [INSERT 3 in 0.5s]3 of 24 START sql table model staging.stg_orders ......... [RUN]3 of 24 OK created sql table model staging.stg_orders .... [SELECT 48213 in 1.1s]4 of 24 START test unique_stg_orders_order_id ............ [RUN]4 of 24 PASS unique_stg_orders_order_id ................... [PASS in 0.4s]This ordering reflects the actual DAG โ the seed and snapshot happened to have no dependencies blocking them, so they ran first, followed by the model that depends on both, immediately followed by its test, before anything downstream of it begins.
dbt build in a Production Orchestration Job
A realistic production job sequence, combining whatโs covered across dbt Sources, dbt Source Freshness, and this command:
dbt depsdbt source freshnessdbt snapshotdbt build --exclude resource_type:snapshotdbt docs generateFreshness first (fail fast if sources are stale), snapshots next (capture history before anything changes further), then the interleaved build-and-test pass, then documentation regeneration as the final step.
Common Mistakes
Assuming dbt build and dbt run + dbt test are equivalent. They produce similar end states on a fully passing run, but differ meaningfully on partial failure โ only dbt build prevents downstream models from building on top of known-bad upstream data within the same invocation.
Including snapshots in every CI run without exclusion. This is one of the most common dbt build misconfigurations โ always exclude snapshots from ephemeral/CI environments unless you specifically intend to test snapshot logic itself.
Using --fail-fast in scheduled production jobs. This can leave you with an incomplete picture of what actually broke, since the run stops at the very first failure instead of surfacing every issue in one pass.
Summary
| Aspect | dbt build |
|---|---|
| Resource types covered | Seeds, models, snapshots, tests โ all in one pass |
| Failure containment | Skips models downstream of a failed test automatically |
| Selection syntax | Identical graph-based syntax to dbt run |
| Typical exclusion | Snapshots, in CI/ephemeral environments |
dbt build is the closer-to-correct default for most production pipelines โ the separate run/test/seed commands remain useful for fast, scoped local iteration, but for anything shipping to production, the interleaved, failure-aware execution of dbt build is worth the switch.