dbt
dbt (data build tool) is a framework for transforming data inside a warehouse using modular SQL models, with built-in testing, documentation and dependency management.
Also called: data build tool, dbt Core, dbt Cloud, dbt models
dbt, short for data build tool, is a framework that lets teams transform raw data inside a warehouse by writing modular SQL models, then test, document and run them in the right order. It handles the T in ELT. For GTM teams, dbt is where definitions like "active account", "qualified pipeline" and "net new ARR" get written once, reviewed like code and reused everywhere.
How it works
A dbt project is a folder of files under version control. The main pieces:
- Models: each model is a
.sqlfile containing a single SELECT statement. dbt wraps it in the right DDL to create a view or table in your data warehouse. - ref(): models reference each other with
{{ ref('stg_deals') }}instead of hard-coded table names. dbt reads those references, builds a dependency graph and runs models in order. - Sources: raw tables loaded by your ingestion tool are declared as sources, so you can track freshness and lineage back to the CRM or billing system.
- Materializations: each model can be a view, a table, an incremental table that only processes new rows, or an ephemeral CTE.
- Tests: built-in generic tests like
unique,not_null,accepted_valuesandrelationshipsrun against your models, and you can write custom ones. - Docs: descriptions in YAML files generate a browsable site with a lineage graph.
The usual layering is staging models (one per source table, light renaming and type casting), intermediate models (joins and business logic) and marts (final tables for dashboards and syncs). Running dbt build executes models and tests together, and teams usually run it on a schedule plus on every pull request.
Example
Say a RevOps lead needs a trusted fct_pipeline table: one row per open opportunity with amount, stage, owner, the account's ICP tier and the account's product usage (assumption). The logic lives in three layers:
stg_crm_opportunitiesandstg_product_accountsclean field names and cast types.int_account_usagesums weekly active users per account.fct_pipelinejoins opportunities to accounts and usage.
Tests guard it: opportunity_id must be unique and not null, stage must be one of eight accepted values. Assume one Friday a CRM admin adds a ninth stage. Before dbt, the dashboard would quietly drop those deals. With the accepted_values test, the nightly build fails, an alert fires, and someone updates the mapping before Monday's pipeline review. If 15 deals averaging $30,000 sat in that new stage, that is $450,000 of pipeline that would have vanished from the forecast.
How to set it up
Start small. Connect dbt to your warehouse, declare sources for the CRM and billing raw tables, and build staging models for only the five to ten tables you actually report on. Add unique and not_null tests to every primary key on day one. Write one mart that answers a real weekly question, then point a dashboard at it.
From there, set up a staging environment or development schema so changes are tested before they hit production tables, and require a pull request review for changes to core marts. When multiple tools need the same metric definitions, add a semantic layer on top. When upstream owners keep breaking your sources, formalize expectations with a data contract.
Common mistakes
- Putting business logic in staging models, which makes every downstream model inherit hidden assumptions.
- Skipping tests because "the data looks fine", then finding duplicates in revenue months later.
- Hard-coding table names instead of using
ref()andsource(), which breaks lineage and run order. - Building one giant model with 400 lines of SQL instead of composable layers.
- Defining ARR or win rate differently in two marts so dashboards disagree.
- Running dbt only manually, so freshness depends on someone remembering.
FAQ
Is dbt an ETL tool?
dbt handles only the T in ELT. It does not extract data from sources or load it into the warehouse. You pair it with an ingestion tool that loads raw data, then dbt transforms that raw data into clean, tested models with SQL.
What is the difference between dbt Core and dbt Cloud?
dbt Core is the free, open-source command line tool you run yourself. dbt Cloud is the managed product from dbt Labs that adds a browser IDE, scheduling, hosted docs and features like the semantic layer. Small teams often start with Core and move to Cloud when they need scheduling and collaboration.
Do GTM teams need dbt?
If your reporting depends on joining CRM, billing and product data in a warehouse, dbt is the standard way to keep that logic tested and versioned. If all your reporting lives inside one CRM, you probably do not need it yet.