Bird
0
0

A dbt test is written as:

medium📝 Debug Q6 of 15
dbt - Governance and Collaboration
A dbt test is written as:
tests:
  - unique
  - not_null
  - accepted_values:
      values: ["active", "inactive"]

What is wrong with this test if the column contains values like "pending"?
AThe test will fail because unique is not allowed with accepted_values
BThe test will pass because all values are strings
CThe test will fail because "pending" is not an accepted value
DThe test will pass because not_null ignores values
Step-by-Step Solution
Solution:
  1. Step 1: Understand accepted_values test

    This test only allows specified values in the column.
  2. Step 2: Check column values against allowed list

    "pending" is not in ["active", "inactive"], so test fails.
  3. Final Answer:

    The test will fail because "pending" is not an accepted value -> Option C
  4. Quick Check:

    Value outside accepted list = Test fail [OK]
Quick Trick: Accepted values test rejects unexpected entries [OK]
Common Mistakes:
MISTAKES
  • Assuming unique conflicts with accepted_values
  • Thinking not_null ignores values
  • Believing all strings pass accepted_values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes