dbt
17 in-depth lessons. Build warehouse transformations the way teams ship them: sources and refs, materializations, tests, Jinja and macros, incremental models, snapshots and CI.
Bronze
Module 1: Project basics
Explain what dbt does and find your way around a project.
- What dbt is (and is not) · Bronze · 6 min read. The T in ELT: models are SELECT statements, dbt compiles them and the warehouse runs them.
- A dbt project, file by file · Bronze · 5 min read. dbt_project.yml, profiles and targets, and the staging, intermediate and marts layout teams use.
Module 2: Building models
Build a model DAG from sources, pick materializations and test the output.
- Sources and staging models · Bronze · 5 min read. Declare raw tables with source(), check their freshness, and clean them once in a staging model.
- ref() and the DAG · Bronze · 5 min read. How ref() builds the dependency graph, picks the right schema per environment, and drives node selection.
- Materializations · Bronze · 5 min read. View, table, ephemeral, incremental and materialized view: what each builds and when to pick it.
- Data tests · Bronze · 5 min read. unique, not_null, accepted_values and relationships, singular tests, and how a test fails: it returns rows.
Silver
Module 3: Jinja and reuse
Write SQL that writes SQL, with vars, macros and packages.
- Jinja in dbt · Silver · 5 min read. Expressions, statements, loops and set: write SQL that writes SQL, and read what it compiles to.
- var(), target and environments · Silver · 4 min read. Parameterise a model with vars, and make dev builds smaller and safer than prod with target.
- Macros and custom generic tests · Silver · 5 min read. Reusable SQL with arguments and defaults, and your own generic tests built the same way.
- Packages and dbt_utils · Silver · 4 min read. packages.yml, dbt deps, and the dbt_utils macros interviews expect you to know, starting with surrogate keys.
Module 4: Change over time
Build incremental models and snapshots.
- Incremental models · Silver · 5 min read. is_incremental(), {{ this }} and unique_key: process only new rows, and the first-run and re-run cases.
- Snapshots (SCD Type 2) · Silver · 5 min read. Record how mutable source rows change over time with the timestamp and check strategies.
Module 5: Testing logic
Unit test a model on fixed rows before it builds.
- Unit tests · Silver · 5 min read. Test a model's logic on fixed input rows before it builds, and how unit tests differ from data tests.
Gold
Module 6: Production incrementals
Pick an incremental strategy and keep re-runs correct with late data.
- Incremental strategies · Gold · 6 min read. append, merge, delete+insert, insert_overwrite and microbatch: what each runs and which one fits.
- Late data and idempotent incrementals · Gold · 5 min read. Lookback windows, re-runs that give the same answer, schema changes and when to full refresh.
Module 7: CI and governance
Build only what changed in CI, and publish models with contracts.
- Slim CI, state and defer · Gold · 5 min read. Build and test only what a pull request changed with state:modified+, --defer and dbt clone.
- Contracts, versions and access · Gold · 5 min read. Guarantee a model's columns and types, version breaking changes, and control who may ref a model.