Transformations: dbt
dbt owns the T in ELT. Transformations are written as SELECT statements, and dbt turns them into tables and views in the warehouse, works out the build order and runs the tests. dbt itself neither stores nor moves data — the warehouse executes all the SQL. An orchestrator usually runs dbt build as one task, and dbt builds the model graph inside it.
Interviews check three things. How models connect: ref() and source() set the build order and the lineage, and a hard-coded table name breaks both. What each materialization actually builds and what incremental costs: the is_incremental() filter, unique_key, late rows, and strategies that differ between adapters. And how a test differs from a contract: a test checks content after the build, a contract checks shape before it.
The current release is dbt Core 1.12. Capabilities depend on the adapter: dbt-clickhouse, for example, has no merge strategy.
Topic map
- Models and lineage — a model as a SELECT,
ref()versussource(), the graph and lineage, the staging → intermediate → marts layers. - Materializations — view, table, incremental and ephemeral;
is_incremental()and--full-refresh; late rows and incremental strategies per adapter. - Tests, contracts and snapshots — generic and singular tests, severity, contracts and their limits, snapshots as SCD2.
Common traps
| Mistake | Consequence |
|---|---|
Writing schema.table instead of ref() | A dev build reads production, and dbt does not know the build order |
Filtering on {{ this }} without is_incremental() | The first build fails: the {{ this }} table does not exist yet |
Leaving an incremental model without unique_key | Re-delivered rows append as duplicates |
| Watermarking on event time | A late row with an old timestamp is never loaded |
Carrying merge to any adapter | dbt-clickhouse lacks it, and merge without unique_key acts as append |
| Mistaking a contract for a data check | A contract checks column names and types; duplicates and NULLs are caught by tests |
Interview relevance
dbt is asked to see whether a candidate can build marts that neither lose nor duplicate rows. A strong answer names the price of a choice: "incremental is cheaper than table, but in exchange I own the late rows and the --full-refresh after a logic change".
Typical checks:
- What a model is and what
ref()andsource()add over a table name. - What each materialization builds and how an incremental model works.
- Which incremental strategy to pick on a given adapter and what
mergedoes without a key. - How a generic test differs from a singular one, when a test stops the build, and what a contract checks.
Common wrong answer: "An ephemeral model creates a temporary table in the warehouse." It creates no object at all: dbt inlines it as a CTE into the models that reference it.