0
0
DbtComparisonBeginner · 3 min read

Dbt run vs dbt build: Key Differences and Usage Guide

dbt run executes only model nodes in your dbt project, while dbt build runs models plus tests, snapshots, and seeds in one command. Use dbt build for a full project build including validation, and dbt run when you want to just compile and run models.
⚖️

Quick Comparison

This table summarizes the main differences between dbt run and dbt build.

Featuredbt rundbt build
PurposeRuns only model nodesRuns models, tests, snapshots, and seeds
Includes TestsNoYes, runs tests after models
Includes SnapshotsNoYes, runs snapshots
Includes SeedsNoYes, loads seeds
Typical Use CaseQuick model executionFull project build and validation
Command IntroducedOriginal dbt commandIntroduced in dbt v1.0
⚖️

Key Differences

dbt run is designed to compile and execute only the model SQL files in your project. It builds the tables or views defined by your models but does not run any tests, snapshots, or seed loading. This makes it faster when you only want to update your models.

On the other hand, dbt build is a newer command introduced in dbt version 1.0 that combines multiple steps into one. It runs models, then runs tests to validate data quality, loads seed files, and executes snapshots if defined. This command is useful for a full project refresh and validation in one go.

Using dbt build helps ensure your data pipeline is not only built but also verified for correctness immediately after. dbt run is more focused and faster when you only need to update models without additional checks.

⚖️

Code Comparison

Here is how you run models using dbt run:

bash
dbt run
Output
Running with dbt=1.x.x Found 3 models, 0 tests, 0 snapshots, 0 seeds 17:00:00 | Concurrency: 4 threads 1 of 3 START model model_a........................ [RUN] 1 of 3 OK created model model_a.................. [OK in 1.2s] 2 of 3 START model model_b........................ [RUN] 2 of 3 OK created model model_b.................. [OK in 1.0s] 3 of 3 START model model_c........................ [RUN] 3 of 3 OK created model model_c.................. [OK in 1.1s] Finished running 3 models in 4.5s.
↔️

dbt build Equivalent

Here is how you run the full build including models, tests, seeds, and snapshots using dbt build:

bash
dbt build
Output
Running with dbt=1.x.x Found 3 models, 2 tests, 1 snapshot, 1 seed 17:05:00 | Concurrency: 4 threads 1 of 3 START model model_a........................ [RUN] 1 of 3 OK created model model_a.................. [OK in 1.2s] 2 of 3 START model model_b........................ [RUN] 2 of 3 OK created model model_b.................. [OK in 1.0s] 3 of 3 START model model_c........................ [RUN] 3 of 3 OK created model model_c.................. [OK in 1.1s] 1 of 2 START test unique_model_a_id............... [RUN] 1 of 2 PASS unique_model_a_id..................... [PASS in 0.5s] 2 of 2 START test not_null_model_b_column......... [RUN] 2 of 2 PASS not_null_model_b_column............... [PASS in 0.4s] 1 of 1 START snapshot snapshot_orders............. [RUN] 1 of 1 OK created snapshot snapshot_orders........ [OK in 2.0s] 1 of 1 START seed seed_data....................... [RUN] 1 of 1 OK loaded seed seed_data................... [OK in 0.3s] Finished running 3 models, 2 tests, 1 snapshot, and 1 seed in 8.5s.
🎯

When to Use Which

Choose dbt run when: You want to quickly build or rebuild only your models without running tests, snapshots, or seeds. This is useful during development or when you know your data quality is already verified.

Choose dbt build when: You want a full project execution that includes building models, running tests to check data quality, loading seeds, and running snapshots. This is ideal for production runs or full refreshes to ensure data correctness.

Key Takeaways

dbt run runs only models, making it faster for model-only builds.
dbt build runs models plus tests, snapshots, and seeds for full validation.
Use dbt run for quick iterative development.
Use dbt build for production or full pipeline execution.
dbt build was introduced in dbt v1.0 to simplify multi-step workflows.