Bird
0
0

What is the output of this dbt-utils test configuration?

medium📝 Predict Output Q5 of 15
dbt - Advanced Testing
What is the output of this dbt-utils test configuration?
tests:
  - dbt_utils.relationship:
      column: customer_id
      to: ref('customers')
      field: id

Assuming some customer_id values do not exist in customers.id, what happens?
AThe test fails due to foreign key violations.
BThe test only checks data types, so it passes.
CThe test throws a compilation error.
DThe test passes because relationship tests ignore missing references.
Step-by-Step Solution
Solution:
  1. Step 1: Understand relationship test purpose

    This test checks that all values in customer_id exist in the referenced customers.id column.
  2. Step 2: Analyze missing references effect

    If some customer_id values are missing in customers.id, the test fails due to foreign key violations.
  3. Final Answer:

    The test fails due to foreign key violations. -> Option A
  4. Quick Check:

    Missing references = test fails [OK]
Quick Trick: Relationship test fails if foreign keys are missing [OK]
Common Mistakes:
MISTAKES
  • Thinking missing references are ignored
  • Confusing relationship test with data type check
  • Assuming compilation error for missing data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes