# Unexpected Task Creation for Non-Referenced Models in Airflow with dbt

**URL:** <https://discourse.getdbt.com/t/unexpected-task-creation-for-non-referenced-models-in-airflow-with-dbt/14697>\
**Category:** Help\
**Tags:** airflow, dbt-core\
**Created:** [August 6, 2024, 12:58pm UTC](https://discourse.getdbt.com/t/unexpected-task-creation-for-non-referenced-models-in-airflow-with-dbt/14697 "2024-08-06T12:58:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lerakilo](https://avatars.discourse-cdn.com/v4/letter/l/ed655f/32.png) [@Lerakilo](https://discourse.getdbt.com/u/Lerakilo)\
**Post date:** [August 6, 2024, 12:58pm UTC](https://discourse.getdbt.com/t/unexpected-task-creation-for-non-referenced-models-in-airflow-with-dbt/14697/1 "2024-08-06T12:58:03Z")

</div>

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:

```auto
-- 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?
