dbt (data build tool) Overview (Data Engineering)
Before you start: working SQL knowledge is assumed (SELECT, JOIN, WHERE). No prior dbt or software-engineering-tooling experience is needed.
dbt in the Data Engineering Context
Before dbt, a typical analytics team's "transformation layer" was one enormous, undocumented SQL script (or a chain of them) that nobody fully understood, had no tests, and broke silently when an upstream source changed. dbt applies software-engineering discipline β version control, modularity, automated testing, documentation β to exactly this problem: a dbt project is a folder of small .sql files, each one a single SELECT statement, and dbt figures out the dependencies between them, runs them in the correct order, and can test the results automatically.
Analogy β Think of a dbt project like a spreadsheet where every cell's formula references another cell by name instead of a hardcoded value. If you change the formula in one cell, every cell that references it recalculates automatically and correctly β you never have to remember to manually update ten other cells by hand. A dbt model works the same way: instead of hardcoding another table's name, you write ref('other_model'), and dbt automatically figures out the correct build order and updates every downstream model when the referenced one changes β the dependency is tracked for you, not something you have to remember.
A Real dbt Model
The two functions doing the real work are source() (marks where raw, dbt-external data enters) and ref() (references another dbt model by name, not by hardcoded table name). Because fct_orders.sql uses ref('stg_orders') instead of writing the literal table name, dbt automatically knows stg_orders must be built first, and if stg_orders's underlying table name ever changes, every model that references it through ref() keeps working without any manual edits.
Why dbt Over Alternatives
Try It (2 Minutes)
dbt can run against a local DuckDB file with zero external warehouse setup:
dbt run completes, open target/run/ and note the models it built β dbt scaffolds two example models (my_first_dbt_model, my_second_dbt_model) so there's something to build immediately.models/example/my_second_dbt_model.sql and find the ref() call referencing the first model β this is the exact mechanism from the fct_orders/stg_orders example above, just with dbt's own starter models.dbt test β dbt runs the built-in tests defined in the scaffolded schema.yml and reports pass/fail, demonstrating the test-as-you-build workflow real dbt projects rely on.
