Commands
Last updated
Last updated
The dbt™ CLI offers a range of commands for executing data transformations. Each command has its own options and parameters, allowing you to precisely control your data transformations. Let's explore these commands and their common use cases.
The bread and butter of dbt™ is the run command. It's like hitting the "Go" button on your data transformations. The dbt run command is the most complex and can be broken down into 4 parts:
Arguments like --select, --exclude and others
Model names to choose what models to run
Method selectors offering ability to fine tune which models to run
Graph selectors offering further fine tuning to apply complex boolean-like logic
Further configure your dbt run
command with these options:
Don't let bad data crash your party.
Use dbt test to keep your transformations in check and apply data quality best practices to your dbt™ transformation pipelines:
Source freshness in dbt™ is like a built-in data freshness checker. It helps you:
Monitor when your source data was last updated
Set expectations for how recent your data should be
Alert you when data is stale
To check the freshness of all your defined sources, run:
Use dbt compile to convert all your dbt™ models with their Jinja references into raw SQL. This is the SQL dbt™ will run against your data warehouse. It's like X-ray vision for your SQL:
When your dbt™ models fail to run, you need to start with the compiled SQL first.
Convert all your schema and table descriptions into static HTML files and then serve them from a server or cloud bucket like AWS S3.
When you can't make head or tail of errors you're seeing during development or production runs, use the --debug option. This will generate additional logs in your terminal to help triage the situation. This is most useful in diagnosing warehouse connection errors.
Capture data changes over time:
The all-in-one command for the impatient:
It runs, tests, and snapshots in one go.
Convert CSV files to tables:
List your models:
Preview your model's output:
Oops, something failed? Try again:
Run custom macros:
Clone your production environment faster than you can say "duplicate":