Bird
0
0

Given this dbt model contract snippet in schema.yml:

medium📝 Predict Output Q13 of 15
dbt - Governance and Collaboration
Given this dbt model contract snippet in schema.yml:
models:
  - name: sales
    contract:
      columns:
        - name: order_id
          tests:
            - not_null
            - unique
        - name: amount
          tests:
            - not_null
What happens if the order_id column contains duplicate values when the model runs?
AThe model run is skipped automatically
BThe model runs successfully but logs a warning
CThe model ignores the duplicates and completes without error
DThe model run fails because the contract test for uniqueness fails
Step-by-Step Solution
Solution:
  1. Step 1: Understand contract tests behavior

    Contract tests like unique enforce data rules strictly. If violated, the model run fails.
  2. Step 2: Apply to duplicate order_id values

    Since order_id must be unique, duplicates cause the test to fail, stopping the model run.
  3. Final Answer:

    The model run fails because the contract test for uniqueness fails -> Option D
  4. Quick Check:

    Contract test fail = model run fails [OK]
Quick Trick: Contract tests fail stop model runs immediately [OK]
Common Mistakes:
MISTAKES
  • Thinking model logs warning but continues
  • Assuming duplicates are ignored
  • Believing model run is skipped automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes