0
0
dbtdata~10 mins

How dbt works (SQL + Jinja + YAML) - Interactive Practice

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

Complete the code to select all columns from the source table in a dbt model.

dbt
select * from [1]
Drag options to blanks, or click blank then click option'
Asource('my_source', 'my_table')
Bref('my_source')
Cconfig('my_source')
Drun_query('my_source')
Attempts:
3 left
💡 Hint
Common Mistakes
Using ref() instead of source() for raw tables.
Trying to call config() or run_query() which are not for table references.
2fill in blank
medium

Complete the YAML snippet to define a source named 'raw_data' with a table 'users'.

dbt
sources:
  - name: [1]
    tables:
      - name: users
Drag options to blanks, or click blank then click option'
Astaging
Bmodels
Craw_data
Danalytics
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'models' or 'staging' which are not source names.
Confusing source name with table name.
3fill in blank
hard

Fix the error in the Jinja code to correctly reference a model named 'orders'.

dbt
select * from [1]
Drag options to blanks, or click blank then click option'
Asource('orders')
Bref('orders')
Cconfig('orders')
Drun_query('orders')
Attempts:
3 left
💡 Hint
Common Mistakes
Using source() to reference models instead of raw tables.
Using config() or run_query() which are not for referencing tables.
4fill in blank
hard

Fill both blanks to create a dbt model that selects user_id and counts orders, grouping by user_id.

dbt
select user_id, count(*) as order_count from [1] group by [2]
Drag options to blanks, or click blank then click option'
Aref('orders')
Buser_id
Corder_id
Dsource('raw_data', 'orders')
Attempts:
3 left
💡 Hint
Common Mistakes
Using source() instead of ref() for models.
Grouping by wrong column like order_id.
5fill in blank
hard

Fill all three blanks to create a YAML test that checks if the 'email' column in 'users' model is unique and not null.

dbt
models:
  - name: users
    columns:
      - name: email
        tests:
          - [1]
          - [2]:
              severity: [3]
Drag options to blanks, or click blank then click option'
Aunique
Bnot_null
Cwarn
Derror
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up test names or severity levels.
Using 'warn' when 'error' is expected for strict checks.