0
0
dbtdata~10 mins

Data mesh patterns with dbt - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a dbt model that selects all columns from the source table.

dbt
select * from [1]
Drag options to blanks, or click blank then click option'
Aref('source_table')
Bmodel('users')
Ctable('users')
Dsource('raw', 'users')
Attempts:
3 left
💡 Hint
Common Mistakes
Using ref() instead of source() for raw tables
Trying to use table() which is not a dbt function
2fill in blank
medium

Complete the code to create a dbt model that references another model named 'customer_orders'.

dbt
select * from [1]
Drag options to blanks, or click blank then click option'
Aref('customer_orders')
Bsource('raw', 'customer_orders')
Ctable('customer_orders')
Dmodel('customer_orders')
Attempts:
3 left
💡 Hint
Common Mistakes
Using source() instead of ref() for models
Using table() which is not a dbt function
3fill in blank
hard

Fix the error in the dbt model code to correctly filter customers with more than 5 orders.

dbt
select customer_id, count(order_id) as order_count from [1] group by customer_id having order_count > 5
Drag options to blanks, or click blank then click option'
Asource('raw', 'orders')
Bref('orders')
Ctable('orders')
Dmodel('orders')
Attempts:
3 left
💡 Hint
Common Mistakes
Using source() for models instead of ref()
Using table() or model() which are not valid dbt functions
4fill in blank
hard

Fill both blanks to create a dbt model that builds a dictionary of customer names and their total amounts, filtering for customers with more than 3 orders.

dbt
select customer_name, sum(order_amount) as total_amount from [1] where order_count [2] 3 group by customer_name
Drag options to blanks, or click blank then click option'
Aref('customer_orders')
B>
C<
Dsource('raw', 'customer_orders')
Attempts:
3 left
💡 Hint
Common Mistakes
Using source() instead of ref()
Using the wrong comparison operator
5fill in blank
hard

Fill all three blanks to create a dbt model that selects customer_id, total orders, and filters for customers with order counts less than 10.

dbt
select [1], count([2]) as total_orders from [3] group by [1] having total_orders < 10
Drag options to blanks, or click blank then click option'
Acustomer_id
Border_id
Cref('orders')
Dcustomer_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using source() instead of ref()
Mixing up customer_name and customer_id
Counting wrong column