Main Commands
dbt init
Bash
# Initializes a new dbt project
dbt init
dbt build
Bash
# Builds and tests selected resources (models, seeds, snapshots, tests)
dbt build
dbt clean
Bash
# Deletes artifacts in the dbt project
# Compiles (does not run) models in a project
# Debugs dbt connections and projects
# Downloads dependencies for a project
dbt clean
dbt compile
Bash
# Compiles models in a project
dbt compile
dbt debug
Bash
# Debugs dbt connections and projects
dbt debug
dbt deps
Bash
# Downloads dependencies for a project
dbt deps
dbt docs
Bash
# Generates documentation for a project
dbt docs
dbt list
Bash
# Lists resources defined in a dbt project
dbt list
dbt parse
Bash
# Parses a project and writes detailed timing info
dbt parse
dbt run
Bash
# Runs the models in a project
# Flags: --full-refresh, --fail-fast, --threads
dbt run
dbt seed
Bash
# Loads CSV files into the database
dbt seed
dbt snapshot
Bash
# Executes "snapshot" jobs defined in a project
dbt snapshot
dbt source
Bash
# Provides tools for working with source data
dbt source
dbt test
Bash
# Executes tests defined in a project
dbt test
dbt rpc
Bash
# Runs an RPC server for client queries
# dbt run-operation - Runs arbitrary maintenance SQL against the database
dbt rpc
dbt serve
Bash
# Starts a webserver to serve documentation locally
dbt serve
Global CLI Flags
–version
Bash
dbt --version #Returns information about the installed dbt version
–record-timing-info
Bash
dbt --record-timing-info #Saves performance profiling information to a file
Syntax Overview
Node Selection
Bash
--select (-s), --exclude, --selector
Methods
Bash
tag, source, path, package, config, test_type, test_name, state, exposure, metric, result
Graph Operators
Bash
dbt run --select my_model+, $ dbt run --select +my_model+ # Plus Operator (+)
Bash
dbt run --select my_model+1, $ dbt run --select 2+my_model # N-plus Operator
Set Operators
Bash
dbt run --select +snowplow_sessions +fct_orders # Unions (space-delineated)
dbt run --select +snowplow_sessions,+fct_orders # Intersections (comma-separated)
At Operator (@)
Bash
dbt run --models @my_model # At Operator (@)
Star Operator (*)
Bash
dbt run --select finance.base.* # Star Operator (*)
Other Flags
–help
Bash
dbt --help. # Shows available commands and arguments
–vars
Bash
dbt --vars # Supplies variables to the project
Examples
Exclude Models
Bash
dbt run --select my_package.*+--exclude my_package.a_big_model+
Graph Operators
Bash
#Plus Operator
dbt run --select my_model+
dbt run --select +my_model+
dbt run --select +my_model+
#N-plus Operator
dbt run --select my_model+1
dbt run --select 2+my_model
Set Operators
Bash
#Unions (space-delineated)
dbt run --select +snowplow_sessions +fct_orders
#Intersections (comma-separated)
dbt run --select +snowplow_sessions,+fct_orders
dbt run --select marts.finance,tag:nightly
dbt test --select +fct_orders,test_type:generic
dbt run --select +snowplow_sessions,+fct_orders
Common Ancestors
Bash
dbt run --select +snowplow_sessions,+fct_orders
dbt run --select 3+my_model+4
dbt run --select my_model+ $ dbt run --select +my_model $ dbt run --select +my_model+
dbt run --select my_model+1 $ dbt run --select 2+my_model
dbt run --select 3+my_model+4
dbt run --select +snowplow_sessions,+fct_orders
dbt run --select +snowplow_sessions,+fct_orders
dbt run --select marts.finance,tag:nightly
dbt test --select +fct_orders,test_type:generic
dbt run --select +snowplow_sessions,+fct_orders
dbt run --select +snowplow_sessions,+fct_orders
dbt run --select marts.finance,tag:nightly
dbt test --select +fct_orders,test_type:generic
Table Of Commands
Command | Description |
---|---|
dbt init | Initializes a new dbt project |
dbt build | Builds and tests selected resources (models, seeds, snapshots, tests) |
dbt clean | Deletes artifacts in the dbt project |
dbt compile | Compiles models in a project |
dbt debug | Debugs dbt connections and projects |
dbt deps | Downloads dependencies for a project |
dbt docs | Generates documentation for a project |
dbt list | Lists resources defined in a dbt project |
dbt parse | Parses a project and writes detailed timing info |
dbt run | Runs the models in a project |
dbt seed | Loads CSV files into the database |
dbt snapshot | Executes “snapshot” jobs defined in a project |
dbt source | Provides tools for working with source data |
dbt test | Executes tests defined in a project |
dbt rpc | Runs an RPC server for client queries |
dbt serve | Starts a webserver to serve documentation locally |
–version | Returns information about the installed dbt version |
–record-timing-info | Saves performance profiling information to a file |
–select (-s), –exclude, –selector | Node selection methods |
–help | Shows available commands and arguments |
–vars | Supplies variables to the project |
–select my_model+, $ dbt run –select +my_model+ | Graph Operators – Plus Operator (+) |
–select my_model+1, $ dbt run –select 2+my_model | Graph Operators – N-plus Operator |
–select +snowplow_sessions +fct_orders | Set Operators – Unions (space-delineated) |
–select +snowplow_sessions,+fct_orders | Set Operators – Intersections (comma-separated) |
–models @my_model | At Operator (@) |
–select finance.base.* | Star Operator (*) |