DBT - Commands
DBT - Commands
1
Running based on tag
dbt run --models tag:tagname - will run only tagged models.
dbt run --models +tag:tagname - will run tagged models and all parents.
dbt run --models tag:tagname+ - will run tagged models and all children.
dbt run --models +tag:tagname+ - will run tagged models and all parents and children.
dbt run --models @tag:tagname - will run tagged, all parents, all children, AND all parents of all
children.
dbt run --exclude tag:tagname - will run all models except the tagged models
In here --models can be replaced by -m.
dbt test can also have all combinations syntax referenced for dbt run
Special commands
help command
help command shows the available input combinations and sub-commands also.
ex: dbt run –help, dbt docs --help
dbt source
It provides subcommands that are helpful when working with source data
dbt source snapshot-freshness - this command will query all the source table defined and
determines the freshness of the tables.
dbt docs
dbt docs generate - a very powerful command which will generate documentation for the models in
your folder based on config files.
dbt docs serve --port 8001 - it will host the docs in your local browser.
Users can have more info about each model, dependencies, and also DAG diagram.
Failing fast
dbt run --fail-fast(x) - to make dbt exit immediately if a single model fails to build. If other models are
in-progress when the first model fails, then dbt will terminate the connections for these still-running
models.