DBT Cheat Sheet
DBT Cheat Sheet
Source
https://www.linkedin.com/in/
https://docs.getdbt.com/
brunoszdl/
dbt clean* Deletes artifacts present in the dbt project *CLI Only*CLI Only
dbt compile Compiles (but does not run) the models in a project
dbt seed Loads CSV files into the database --threads Specifies the number of threads to use while
executing models
dbt snapshot Executes "snapshot" jobs defined in a project
Node selection
Syntax overview Specifying resources
The –select flag accepts one or more arguments. Each argument can be one
command arguments of compatibility.
• A packages name
run --select (-s), --exclude, --selector, --defer • A model name
• A fully-qualified path to a directory of models
test --select (-s), --exclude, --selector, --defer • A selection method (path:, tag:, config:, test_type:, test_name:)
Examples:
seed --select (-s), --exclude, --selector • $ dbt run --select my_dbt_project_name - all models in your project
• $ dbt run --select my_dbt_model - a specific model
• $ dbt run --select path.to.my.models - all models in a specific directory
snapshot --select (-s), --exclude, --selector • $ dbt run --select tag:nightly - models with the "nightly" tag
• $ dbt run --select path/to/models - models contained in path/to/models
list --select (-s), --exclude, --selector, --resource-type • $ dbt test --select test_type:generic - run all generic tests
• $ dbt test --select test_type:singular - run all singular tests
compile --select (-s), --exclude, --selector • $ dbt test --select test_name:unique - run all instances of the `unique` test
At operator(@)
• $ dbt run --models @my_model - select my_model, its children, and the parents of its metric result source_status
children
Star operator(*)
• $ dbt run --select finance.base.* - run all of the models in models/finance/base
Set operators
Unions (space-delineated)
• $ dbt run --select +snowplow_sessions +fct_orders - run snowplow_sessions, all ancestors of snowplow_sessions, fct_orders, and all ancestors of fct_orders)