# execute DBT models with python runner dynamically

**URL:** <https://discourse.getdbt.com/t/execute-dbt-models-with-python-runner-dynamically/13323>\
**Category:** In-Depth Discussions\
**Tags:** python-models, dbt-core\
**Created:** [May 13, 2024, 10:13am UTC](https://discourse.getdbt.com/t/execute-dbt-models-with-python-runner-dynamically/13323 "2024-05-13T10:13:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RP\_007](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@RP\_007](https://discourse.getdbt.com/u/RP_007)\
**Post date:** [May 13, 2024, 10:13am UTC](https://discourse.getdbt.com/t/execute-dbt-models-with-python-runner-dynamically/13323/1 "2024-05-13T10:13:44Z")

</div>

I recently came across [python models in DBT](https://docs.getdbt.com/docs/build/python-models#code-reuse) and [DBTRunner](https://docs.getdbt.com/reference/programmatic-invocations)

if there any way that we can combine both in one py model?  
It will run model names to be executed from a table and execute them

---

<div class="post-metadata">

**Author:** ![janny55](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/janny55/32/4107_2.png) [@janny55](https://discourse.getdbt.com/u/janny55)\
**Post date:** [June 14, 2024, 5:24am UTC](https://discourse.getdbt.com/t/execute-dbt-models-with-python-runner-dynamically/13323/2 "2024-06-14T05:24:09Z")

</div>

As per my experience: You can try creating a Python script that searches a table to get the model names.  
Use a loop to cycle between these names and apply the necessary processing functions from dbt and dbt runner.

Let me know about the result 🥰
