A. Missing dash (-) before 'name' to define list item
B. Incorrect key 'description' instead of 'desc'
C. YAML does not support descriptions
D. Model name should be uppercase
Solution
Step 1: Check YAML list syntax for models
dbt expects 'models:' followed by a list indicated by '-'. Missing dash means no list item.
Step 2: Identify the missing dash before 'name'
Without '-', YAML treats 'name' as a key under 'models', not a list item, so description is ignored.
Final Answer:
Missing dash (-) before 'name' to define list item -> Option A
Quick Check:
Dash defines list items in YAML [OK]
Hint: Always use dash for list items in YAML [OK]
Common Mistakes:
Using wrong key names
Thinking YAML disallows descriptions
Ignoring YAML indentation rules
5. You want to improve data discoverability by adding descriptions to columns in a dbt model. Which YAML snippet correctly documents the 'customer_id' column with a description?
hard
A. models:
- name: customers
columns:
- name: customer_id
desc: 'Unique ID for each customer'
B. models:
- name: customers
columns:
customer_id: 'Unique ID for each customer'
C. models:
- name: customers
columns:
- customer_id: 'Unique ID for each customer'
D. models:
- name: customers
columns:
- name: customer_id
description: 'Unique ID for each customer'
Solution
Step 1: Recall correct YAML structure for column documentation in dbt
Columns are listed as items with '- name:' and 'description:' keys.
Step 2: Identify the option matching this structure
models:
- name: customers
columns:
- name: customer_id
description: 'Unique ID for each customer' correctly uses '- name: customer_id' and 'description' key.
Final Answer:
models:\n - name: customers\n columns:\n - name: customer_id\n description: 'Unique ID for each customer' -> Option D
Quick Check:
Correct column description syntax [OK]
Hint: Use '- name:' and 'description:' for columns in YAML [OK]