What Is dbt? The Data Build Tool Explained
dbt (data build tool) lets data teams transform warehouse data using version-controlled, tested SQL, applying software engineering practices to analytics.
dbt brought the "as code" mindset to analytics. Instead of ad hoc SQL scripts, dbt turns each transformation into a model - a SELECT statement in a file - that is version-controlled, tested, documented, and built in dependency order inside your data warehouse.
What dbt is
dbt is a transformation tool that runs the T in ELT. You write SQL SELECT statements as models; dbt wraps them in the right CREATE TABLE or CREATE VIEW statements and runs them against your warehouse. It handles dependencies, so models build in the correct order.
Tests and documentation
dbt lets you declare tests - not null, unique, accepted values, relationships - directly on columns, and it can generate documentation and a lineage graph of how models depend on each other. This makes a warehouse transformation layer testable like application code.
The DAG of models
dbt builds a DAG from the references between models. Running "dbt build" compiles the SQL, runs the models in dependency order, and executes the tests, failing the run if any test does not pass - exactly the quality-gate behavior CI relies on.
dbt in CI
A common pattern runs dbt against a CI schema on every pull request, building and testing only the models that changed, so a broken transformation is caught before it merges.
steps:
- run: pip install dbt-snowflake
- run: dbt deps
- run: dbt build --select state:modified+ --target ciLatchkey note
dbt CI jobs install adapters and download artifacts from past runs to figure out what changed. On Latchkey, caching the Python environment and dbt artifacts between runs speeds up these jobs, and auto-retry helps when a warehouse connection blips mid-run.
Key takeaways
- dbt transforms warehouse data with version-controlled, tested SQL models built in dependency order.
- Built-in tests and lineage make the transformation layer as reviewable as application code.
- Running "dbt build" on changed models in CI catches broken transformations before they merge.