Skip to content
IT glossary
Data and MLUpdated December 3, 2026

dbt

A tool for transforming data that has already been loaded into a warehouse. It helps teams write transformations in SQL, run them in dependency order, and check the results.

What dbt does

A warehouse might contain a raw orders table, but a dashboard needs something more specific: one row per customer with a count of paid orders. In dbt, you typically write that transformation as a SQL SELECT in a file called a model. Rather than copying the query into several dashboards, you can build a shared dataset and keep its logic, tests, and documentation under version control.

How a dbt project runs

A model uses source() to refer to a declared input table, such as a table populated by a loading tool. It uses ref() to refer to another model. These calls resolve to database object names and tell dbt how models depend on one another. dbt builds a directed acyclic graph (DAG) from those dependencies and runs selected models in dependency order. Selecting one model does not automatically rebuild its inputs: dbt build --select +customer_orders explicitly includes upstream dependencies.

The warehouse executes the SQL; dbt renders the templates and issues the statements. A model's materialization controls how its output is made available. A view generally computes its result when queried. A table stores the result and is rebuilt when the model runs. An incremental model can update a stored result without recomputing everything, but it needs logic to pick up new or changed rows correctly.

Example: counting paid orders

The model customer_orders.sql reads a cleaned orders model:

select
    customer_id,
    count(*) as paid_order_count
from {{ ref('stg_orders') }}
where status = 'paid'
group by customer_id

The count assumes stg_orders has one row per order. Adding unique and not_null data tests to order_id in that model checks the assumption directly. A uniqueness test on customer_id in the final model would check that the output has at most one row per customer, but it would not catch duplicate orders that have already inflated the counts.

Where it fits and what interviewers ask

dbt usually handles the T in ELT: data is extracted and loaded first, then transformed where it is stored. An orchestrator such as Airflow can wait for a load to finish and then trigger a dbt job. A BI tool can query the resulting models. The dbt dependency graph orders transformations; it does not, by itself, pull fresh data from an external API.

A common interview question is when to choose a view, a table, or an incremental model. Explain the trade-off between doing work at query time and doing it during a build. For incremental processing, describe how you would handle an older order that becomes paid today: filtering only for newly created orders would miss the change.