dbt run
Builds models (and related materializations like incremental tables). It does not run tests, seeds, or snapshots by itself.
dbt build
Runs a unified DAG of resources in dependency order: seeds, snapshots, models, and tests. A test that depends on a model runs after that model succeeds. If an upstream resource fails, downstream work for that branch is skipped.
dbt run → models (create/replace/merge SQL)
dbt build → seed → snapshot → model → test (in DAG order)
(and skip children when a parent fails)When to use which
- `dbt run`: quick iteration while developing a model; you will test separately.
- `dbt build`: CI and production jobs where you want "build then prove quality" as one graph.
- `dbt test`: run tests only (assumes models already exist).
Example
dbt run --select stg_orders+ # models only dbt build --select stg_orders+ # models + their tests (and more if selected)
Interview tip: Prefer dbt build in pipelines: it fails fast on bad data and respects test nodes as first-class DAG citizens, not a separate afterthought script.