Bird
0
0

You wrote this dbt model in the marts layer:

medium📝 Debug Q14 of 15
dbt - Project Organization
You wrote this dbt model in the marts layer:
SELECT
  customer_id,
  SUM(total_orders) AS total_orders
FROM {{ ref('int_customer_orders') }}
GROUP BY customer_id

But the model fails with an error about total_orders. What is the likely cause?
AMissing GROUP BY clause
BSUM() cannot be used in marts layer
CIncorrect use of {{ ref() }} syntax
DThe referenced model <code>int_customer_orders</code> does not have a column named <code>total_orders</code>
Step-by-Step Solution
Solution:
  1. Step 1: Check referenced model columns

    The error suggests total_orders column is missing in int_customer_orders.
  2. Step 2: Validate aggregation usage

    SUM() is valid in marts layer and GROUP BY is present, so those are not issues.
  3. Final Answer:

    The referenced model int_customer_orders does not have a column named total_orders -> Option D
  4. Quick Check:

    Column missing in referenced model causes error [OK]
Quick Trick: Check referenced model columns before aggregating [OK]
Common Mistakes:
MISTAKES
  • Assuming SUM() is invalid in marts
  • Forgetting GROUP BY with aggregation
  • Misusing ref() syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes