Complete the code to select all columns from the source table in a dbt model.
select * from [1]
In dbt, source() is used to refer to raw tables defined in YAML source configurations.
Complete the YAML snippet to define a source named 'raw_data' with a table 'users'.
sources:
- name: [1]
tables:
- name: usersThe name under sources defines the source name, here it should be 'raw_data'.
Fix the error in the Jinja code to correctly reference a model named 'orders'.
select * from [1]
To reference another dbt model, use ref('model_name'). source() is for raw tables.
Fill both blanks to create a dbt model that selects user_id and counts orders, grouping by user_id.
select user_id, count(*) as order_count from [1] group by [2]
The table is referenced by ref('orders') and grouping is done by user_id.
Fill all three blanks to create a YAML test that checks if the 'email' column in 'users' model is unique and not null.
models:
- name: users
columns:
- name: email
tests:
- [1]
- [2]:
severity: [3]The tests unique and not_null check column constraints. Severity error marks failures as errors.