I’m using Airflow to orchestrate my dbt models. I have intermediate-level models my_orders
and my_items
, both of which are materialized. These intermediate models are built from my_order_stg
and my_items_stg
respectively, which are ephemeral models (not materialized).
In the my_orders
model, I use a reference to my_items_stg
like this:
-- models/intermediate/my_orders.sql
WITH my_items_data AS (
SELECT * FROM {{ ref('my_items_stg') }}
)
SELECT ...
The issue is that when I run the Airflow DAG created for the my_orders
table, Airflow unexpectedly creates a task for the my_items
model. This is confusing because I am not referencing the my_items
model in my_orders
; I am referencing my_items_stg
, which is an ephemeral model and should be treated as a CTE. I run into this issue with many different models. Why is this happening?