# Questions on pre-hook

**URL:** <https://discourse.getdbt.com/t/questions-on-pre-hook/7870>\
**Category:** Help\
**Created:** [April 17, 2023, 6:26am UTC](https://discourse.getdbt.com/t/questions-on-pre-hook/7870 "2023-04-17T06:26:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Process](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@Process](https://discourse.getdbt.com/u/Process)\
**Post date:** [April 17, 2023, 6:26am UTC](https://discourse.getdbt.com/t/questions-on-pre-hook/7870/1 "2023-04-17T06:26:13Z")

</div>

Hi,  
I have 2 questions on pre-hook:

1. I need to put a table as source, and also use it as a model. So the table needs to exist at the first beginning. I tried to use pre\_hook to run DDL in the table model. I found the pre-hook will run so table will be created but the model will fail and complain the table has existed. The reason should be somehow dbt will not create the backup table when it doesn’t exist at first. Is there a way to fix this?

2. I expect the pre-hook to run the DDL can be a separate step in airflow generated by dbt. Is there a way to do this?

Thanks

---

<div class="post-metadata">

**Author:** ![jaypeedevlin](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/jaypeedevlin/32/638_2.png) [@jaypeedevlin](https://discourse.getdbt.com/u/jaypeedevlin)\
**Post date:** [April 17, 2023, 6:32am UTC](https://discourse.getdbt.com/t/questions-on-pre-hook/7870/2 "2023-04-17T06:32:48Z")

</div>

On the face of it, it seems like you might be doing something that might be better expressed as an [incremental model](https://docs.getdbt.com/docs/build/incremental-models), although without more context it’s hard to say definitively. I would look at that option first, because dbt is trying to build a DAG, and the A in DAG stands for Acyclic, eg there are no cycles in the graph.

---

<div class="post-metadata">

**Author:** ![Process](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@Process](https://discourse.getdbt.com/u/Process)\
**Post date:** [April 18, 2023, 1:33am UTC](https://discourse.getdbt.com/t/questions-on-pre-hook/7870/3 "2023-04-18T01:33:24Z")

</div>

Our requirements are:

```auto
-- model1
select ... something join model2
--model2
select * from model1 where last partition

```

We have to put model2 as source, else dbt complains cycle.
