Skip to content
BENIBIX Learn

dbt (Data Build Tool)

Data⚙️ ProcessingData Transformation

Also known as dbt, Data Build Tool, dbt Core, dbt Cloud

A tool that runs your SQL files. Each one builds a table, in the right order.

Think of it like

It is like a recipe book for your data. Each recipe says what to use, and the book cooks them in the right order.

Example

A team keeps 120 SQL models in Git. Each night, dbt builds them in order and runs 300 tests.

Why it matters

It brings code habits to SQL: version control, tests, reviews and docs. That made it the usual tool for the T in ELT.

Definition

dbt is a tool for writing data transformations as SQL files. Each file is one SELECT that builds a table or view in the warehouse. Files point to each other with ref(), so dbt knows the order to run them in. It also runs tests on the results and writes docs from the code. dbt Core is free and open source; dbt Cloud is the paid service.

Example code

console
$ dbt run --select daily_sales
1 of 1 OK created sql table model analytics.daily_sales
Build one model. dbt writes the SQL and creates the table in the warehouse.

Common mistake

Writing table names by hand instead of using ref(). dbt then cannot work out the order.

Key takeaways

  1. 1
    A SELECT per file. Each one builds a table or view.
  2. 2
    ref() sets the order. dbt builds the graph.
  3. 3
    Tests and docs. Kept beside the code.

Compare