Bird
0
0

Which of the following is the correct syntax to define a model contract in a dbt model's schema.yml file?

easy📝 Syntax Q12 of 15
dbt - Governance and Collaboration
Which of the following is the correct syntax to define a model contract in a dbt model's schema.yml file?
Amodels: - name: my_model access_control: users: - admin
Bmodels: - name: my_model schedule: cron: '0 0 * * *'
Cmodels: - name: my_model contract: columns: - name: id tests: - not_null
Dmodels: - name: my_model dashboard: enabled: true
Step-by-Step Solution
Solution:
  1. Step 1: Identify the syntax for model contracts in schema.yml

    Model contracts are defined under the contract key with column tests inside schema.yml.
  2. Step 2: Match options to this syntax

    models: - name: my_model contract: columns: - name: id tests: - not_null correctly shows contract with columns and tests. Others show unrelated keys like access_control, schedule, or dashboard.
  3. Final Answer:

    models: - name: my_model contract: columns: - name: id tests: - not_null -> Option C
  4. Quick Check:

    Contract syntax = models: - name: my_model contract: columns: - name: id tests: - not_null [OK]
Quick Trick: Look for 'contract' key with column tests in schema.yml [OK]
Common Mistakes:
MISTAKES
  • Confusing access control syntax with contract syntax
  • Using schedule or dashboard keys incorrectly
  • Missing indentation in YAML

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes