Challenge - 5 Problems
dbt Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Jinja expression in a dbt model?
Given the following Jinja code snippet inside a dbt SQL model, what will be the output SQL after rendering?
dbt
{% set threshold = 10 %}
SELECT * FROM sales WHERE amount > {{ threshold }}Attempts:
2 left
💡 Hint
Remember that Jinja variables inside {{ }} are replaced with their values during rendering.
✗ Incorrect
The variable 'threshold' is set to 10, so {{ threshold }} is replaced by 10 in the final SQL.
❓ data_output
intermediate2:00remaining
What data does this dbt model produce?
Consider this dbt model SQL code using Jinja:
{% raw %}
SELECT user_id, COUNT(*) AS order_count
FROM {{ ref('orders') }}
GROUP BY user_id
HAVING COUNT(*) > 5
{% endraw %}
What does this model output?
dbt
SELECT user_id, COUNT(*) AS order_count
FROM orders
GROUP BY user_id
HAVING COUNT(*) > 5Attempts:
2 left
💡 Hint
HAVING filters groups after aggregation.
✗ Incorrect
The query groups orders by user_id and keeps only those with more than 5 orders.
🔧 Debug
advanced3:00remaining
Why does this dbt YAML config cause an error?
Given this dbt model configuration in YAML:
models:
my_project:
+materialized: table
my_model:
+tags: ['finance', 'monthly']
What is the cause of the error when running dbt?
dbt
models:
my_project:
+materialized: table
my_model:
+tags: ['finance', 'monthly']Attempts:
2 left
💡 Hint
Model-specific configs must be nested under the model name.
✗ Incorrect
The '+materialized' config applies to models and should be nested under the model name, not the project.
🚀 Application
advanced2:00remaining
How does dbt handle model dependencies with ref()?
In dbt, what is the effect of using {{ ref('model_b') }} inside model_a.sql?
Attempts:
2 left
💡 Hint
Think about how dbt builds the DAG of models.
✗ Incorrect
The ref() function creates a dependency so dbt runs model_b before model_a and references its output.
🧠 Conceptual
expert3:00remaining
What is the role of Jinja templating in dbt models?
Which statement best describes how Jinja templating works in dbt?
Attempts:
2 left
💡 Hint
Jinja runs before SQL is sent to the database.
✗ Incorrect
dbt uses Jinja to generate SQL dynamically by processing variables and logic before execution.