Bird
0
0

Given this YAML test snippet:

medium📝 Predict Output Q4 of 15
dbt - Advanced Testing
Given this YAML test snippet:
tests:
  - dbt_utils.accepted_values:
      column: status
      values: ['active', 'inactive']

What will happen if the status column contains the value 'pending'?
AThe test will pass because 'pending' is treated as NULL.
BThe test will ignore 'pending' values and pass.
CThe test will fail because 'pending' is not in the accepted values list.
DThe test will throw a syntax error.
Step-by-Step Solution
Solution:
  1. Step 1: Understand accepted_values test behavior

    This test checks that all values in the column are within the specified list.
  2. Step 2: Check if 'pending' is in the list

    'pending' is not in ['active', 'inactive'], so the test will fail.
  3. Final Answer:

    The test will fail because 'pending' is not in the accepted values list. -> Option C
  4. Quick Check:

    Value outside accepted list = test fails [OK]
Quick Trick: Values outside accepted list cause test failure [OK]
Common Mistakes:
MISTAKES
  • Assuming unknown values are ignored
  • Thinking test passes with extra values
  • Confusing syntax error with data error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes