Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a view materialization in dbt?
A view materialization creates a virtual table in the database. It does not store data physically but runs the query every time you access it, like a saved question you ask repeatedly.
Click to reveal answer
beginner
How does a table materialization differ from a view in dbt?
A table materialization creates a physical table in the database. It stores the data permanently until refreshed, so queries run faster because data is precomputed.
Click to reveal answer
intermediate
What is the purpose of incremental materialization in dbt?
Incremental materialization updates only new or changed data in a table instead of rebuilding the whole table. This saves time and resources when working with large datasets.
Click to reveal answer
intermediate
Explain ephemeral materialization in dbt.
Ephemeral materialization does not create any table or view. Instead, it inlines the SQL code into downstream models. It's like a temporary helper used only during query execution.
Click to reveal answer
intermediate
When should you use incremental materialization instead of table materialization?
Use incremental when your data updates regularly but only a small part changes each time. It speeds up processing by adding or updating just new data, not rebuilding everything.
Click to reveal answer
Which dbt materialization creates a virtual table that runs the query every time you access it?
AView
BTable
CIncremental
DEphemeral
✗ Incorrect
A view materialization creates a virtual table that runs the query on demand.
What does table materialization do in dbt?
ACreates a temporary inline SQL snippet
BCreates a physical table storing data
CUpdates only new data
DCreates a virtual table without storing data
✗ Incorrect
Table materialization creates a physical table that stores data permanently.
Which materialization is best for large datasets that update incrementally?
AView
BTable
CIncremental
DEphemeral
✗ Incorrect
Incremental materialization updates only new or changed data, saving time.
What happens with ephemeral materialization in dbt?
AInlines SQL code into downstream models
BCreates a physical table
CCreates a view
DUpdates data incrementally
✗ Incorrect
Ephemeral materialization inlines SQL code and does not create tables or views.
Why choose incremental over table materialization?
ATo inline SQL code
BTo store data permanently
CTo create a virtual table
DTo update only new or changed data
✗ Incorrect
Incremental materialization updates only new or changed data, improving efficiency.
Describe the four types of materializations in dbt and when to use each.
Think about how data is stored or updated in each type.
You got /4 concepts.
Explain how incremental materialization improves performance compared to full table rebuilds.
Consider what happens when you update a big table fully versus partially.
You got /3 concepts.
Practice
(1/5)
1. Which dbt materialization creates a permanent table in the database that stores data physically?
easy
A. table
B. view
C. incremental
D. ephemeral
Solution
Step 1: Understand the purpose of 'table' materialization
The 'table' materialization creates a physical table in the database that stores data permanently.
Step 2: Compare with other materializations
'view' creates a virtual table, 'incremental' updates existing tables efficiently, and 'ephemeral' runs inline SQL without creating tables.
Final Answer:
table -> Option A
Quick Check:
Permanent storage = table [OK]
Hint: Permanent data storage means 'table' materialization [OK]
Common Mistakes:
Confusing 'view' with 'table' as both represent data
Thinking 'incremental' creates a full new table every time
Assuming 'ephemeral' creates physical tables
2. Which of the following is the correct syntax to specify an incremental materialization in a dbt model's config block?
easy
A. config(materialization = 'incremental')
B. config(materialized = 'incremental')
C. materialized('incremental')
D. set materialized = incremental
Solution
Step 1: Recall dbt config syntax for materialization
dbt uses config() with the keyword 'materialized' to set materialization type.
Step 2: Identify the correct keyword and format
The correct syntax is config(materialized = 'incremental'). Other options use wrong keywords or syntax.
Final Answer:
config(materialized = 'incremental') -> Option B
Quick Check:
Correct keyword is 'materialized' inside config() [OK]
Hint: Use config(materialized = 'type') syntax for materializations [OK]
Common Mistakes:
Using 'materialization' instead of 'materialized'
Trying to call materialized as a function
Using SQL-like SET syntax instead of config()
3. Given this dbt model config and SQL snippet:
-- model.sql
{{ config(materialized='incremental', unique_key='id') }}
select id, value from source_table
{% if is_incremental() %}
where updated_at > (select max(updated_at) from {{ this }})
{% endif %}
What happens when you run this model multiple times?
medium
A. The model rebuilds the entire table every time
B. The model creates a view that always shows fresh data
C. The model appends only new or updated rows based on 'updated_at'
D. The model runs inline SQL without creating a table
Solution
Step 1: Understand incremental materialization with unique_key
The model uses incremental materialization with a unique key 'id' to update data efficiently.
Step 2: Analyze the is_incremental() condition
When running incrementally, it filters rows where 'updated_at' is newer than the max in the existing table, appending only new or updated rows.
Final Answer:
The model appends only new or updated rows based on 'updated_at' -> Option C
Quick Check:
Incremental + filter = append updates [OK]
Hint: Incremental with is_incremental() filters new data only [OK]
Common Mistakes:
Thinking incremental rebuilds full table every run
Confusing view materialization with incremental
Ignoring the is_incremental() condition
4. You wrote this dbt model:
{{ config(materialized='ephemeral') }}
select * from source_table
But when you run dbt, you get an error saying the model is not found. What is the likely cause?
medium
A. Ephemeral models do not create tables or views, so they cannot be run directly
B. The config syntax for ephemeral is incorrect
C. Ephemeral models require a unique_key to run
D. You must specify incremental materialization for ephemeral models
Solution
Step 1: Recall what ephemeral materialization does
Ephemeral models do not create tables or views; their SQL is inlined into dependent models.
Step 2: Understand why the error occurs
Since ephemeral models don't create database objects, running them directly causes a 'model not found' error.
Final Answer:
Ephemeral models do not create tables or views, so they cannot be run directly -> Option A
Quick Check:
Ephemeral = inline SQL, no table/view created [OK]
Hint: Ephemeral models can't be run alone; they inline SQL [OK]
Common Mistakes:
Trying to run ephemeral models directly
Assuming ephemeral needs unique_key
Confusing ephemeral with incremental
5. You want to build a dbt model that: - Stores data permanently - Updates only new rows efficiently - Avoids rebuilding the entire dataset each run
Which materialization should you choose and why?
hard
A. Use 'table' materialization because it stores data permanently and rebuilds fully each run
B. Use 'ephemeral' materialization because it runs inline SQL without storage
C. Use 'view' materialization because it always shows fresh data without storage
D. Use 'incremental' materialization because it stores data permanently and updates only new rows
Solution
Step 1: Identify permanent storage requirement
Both 'table' and 'incremental' materializations store data permanently.
Step 2: Consider update efficiency
'Table' rebuilds fully each run, while 'incremental' updates only new or changed rows efficiently.
Step 3: Match requirements
Since you want to avoid full rebuilds and update only new rows, 'incremental' fits best.
Final Answer:
Use 'incremental' materialization because it stores data permanently and updates only new rows -> Option D