Bird
0
0

You wrote this dbt model but it fails with a compilation error. What is the likely cause?

medium📝 Debug Q14 of 15
dbt - Advanced Patterns
You wrote this dbt model but it fails with a compilation error. What is the likely cause?
WITH base AS (
  SELECT *
  FROM ref('orders')
)
SELECT * FROM base
AMissing curly braces around ref function
BIncorrect CTE name 'base'
CSELECT * is not allowed in dbt models
DMissing GROUP BY clause
Step-by-Step Solution
Solution:
  1. Step 1: Check the usage of ref() in the CTE

    The ref function must be wrapped in double curly braces like {{ ref('orders') }} to be recognized by dbt.
  2. Step 2: Identify the error cause

    Without curly braces, dbt treats ref('orders') as plain text, causing a compilation error.
  3. Final Answer:

    Missing curly braces around ref function -> Option A
  4. Quick Check:

    Always use {{ ref() }} with curly braces = A [OK]
Quick Trick: Always wrap ref() in {{ }} in dbt SQL [OK]
Common Mistakes:
MISTAKES
  • Forgetting curly braces around ref()
  • Thinking CTE names cause errors
  • Assuming SELECT * is invalid in dbt

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes