Bird
0
0

Which of the following is the correct way to reference another model in a dbt SQL file?

easy📝 Syntax Q12 of 15
dbt - Governance and Collaboration
Which of the following is the correct way to reference another model in a dbt SQL file?
ASELECT * FROM ref('model_name')
BSELECT * FROM model_name()
CSELECT * FROM {{ ref('model_name') }}
DSELECT * FROM $ref.model_name
Step-by-Step Solution
Solution:
  1. Step 1: Recall dbt ref syntax

    dbt uses the Jinja function ref() inside double curly braces to reference models.
  2. Step 2: Match syntax with options

    SELECT * FROM {{ ref('model_name') }} uses the correct syntax: {{ ref('model_name') }} inside SQL.
  3. Final Answer:

    SELECT * FROM {{ ref('model_name') }} -> Option C
  4. Quick Check:

    dbt ref() = {{ ref('model') }} [OK]
Quick Trick: Use double curly braces and ref() to reference models [OK]
Common Mistakes:
MISTAKES
  • Omitting curly braces around ref()
  • Using parentheses after model name
  • Using incorrect variable syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes