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

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)