# How to refer ephemeral model in pre/post hook of an incremental model

**URL:** https://discourse.getdbt.com/t/how-to-refer-ephemeral-model-in-pre-post-hook-of-an-incremental-model/1763
**Category:** Archive
**Created:** [October 31, 2020, 1:10pm UTC](https://discourse.getdbt.com/t/how-to-refer-ephemeral-model-in-pre-post-hook-of-an-incremental-model/1763 "2020-10-31T13:10:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Gautam.Bishnoi](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@Gautam.Bishnoi](https://discourse.getdbt.com/u/Gautam.Bishnoi)
#### Post date: [October 31, 2020, 1:10pm UTC](https://discourse.getdbt.com/t/how-to-refer-ephemeral-model-in-pre-post-hook-of-an-incremental-model/1763/1 "2020-10-31T13:10:26Z")

</div>

I have an incremental model which is upserting the data. I want to delete the data from this model on the basis of time period column which is coming from one of the ephemeral model. I have referenced ephemeral model in pre hook using ‘ref’ function but it is not replicating the CTE.

It is generating SQL as below Delete from abc.xyz where time\_period in (select distinct time\_period from \_\_dbt\_\_CTE\_\_ephemeral\_model)
