dbt practice problems
15 free dbt interview problems: write models with source() and ref(), Jinja, macros, data tests and incremental models, graded on hidden tests.
Sources & staging
source(), renaming and casting, null-safe filters and deduplicating change data.
- Staging Model for Raw Orders · Easy
- Latest Version of Each Customer · Medium
Refs & marts
ref(), joining staging models into one row per entity without fan-out.
- Customer Order Summary Mart · Medium
Jinja, vars & packages
loops, if blocks, var(), target and dbt_utils macros.
- Daily Revenue for a Reporting Window · Easy
- Pivot Payments with a Jinja Loop · Medium
- Smaller Builds in Development · Medium
- Surrogate Key for Order Lines · Medium
Macros
reusable SQL with arguments and defaults.
Data tests
singular tests and generic tests that return failing rows.
- Data Test: Refunds Larger Than the Order · Easy
- A Reusable not_negative Test · Medium
- Orphaned Rows: a relationships Test · Medium
Incremental models
is_incremental(), {{ this }}, unique_key, strategies and late data.