How to Run dbt
Install dbt-core via pip, configure your profiles.yml with warehouse credentials, and run dbt run inside your project directory. dbt will compile your SQL models and execute them against your warehouse.
1
Install dbt
pip install dbt-core dbt-snowflake # or dbt-bigquery, dbt-redshift, dbt-duckdb
Install the adapter for your specific warehouse.
2
Initialize a project
dbt init my_project cd my_project
3
Configure profiles.yml
my_project: target: dev outputs: dev: type: snowflake account: your_account user: your_user password: your_password role: transformer database: analytics warehouse: compute_wh schema: dbt_dev
profiles.yml lives at ~/.dbt/profiles.yml by default.
4
Test the connection
dbt debugShould show: “All checks passed!”
5
Run your models
dbt run # run all models dbt run --select stg_orders # run one model dbt test # run data quality tests dbt docs generate && dbt docs serve # view lineage
What Happens When You Run dbt
When you run dbt run, dbt reads your .sql model files, resolves dependencies using ref() and source() calls, compiles them into warehouse SQL, and executes them in the correct order. Models are materialized as tables or views depending on your config.
When to Use This
- Developing new models locally before pushing to CI
- Testing transformations against a dev schema
- Debugging a failing model in production
- Running a one-off backfill
Common Issues
profiles.yml not foundFile must be at ~/.dbt/profiles.yml or set DBT_PROFILES_DIRCould not connect to warehouseCheck credentials, VPN, and warehouse IP allowlistModel not foundCheck your model-paths in dbt_project.ymlref() called before model existsDependency order issue — check your DAG