How to change execution commands with dbt jobs

Hi Guys.
Please, I’m trying to create a dbt job that will be performed a lot of times, for example, 3 times.
I need to pass a different parameter for the same model:

dbt run --select fact_xpto --vars ‘{“SchemaSource”: “PROD_A”}’
dbt run --select fact_xpto --vars ‘{“SchemaSource”: “PROD_B”}’
dbt run --select fact_xpto --vars ‘{“SchemaSource”: “PROD_C”}’

How can I schedule a job like that?
Is possible to create a loop based on a table or in dbt_project.yml?

Tks

1 Like

What tool are you using for your orchestration? dbt Cloud or a different tool like airflow etc?

dbt Core itself does not support looping over multiple invocations - this will have to be something that is triggered by your orchestration tool.

1 Like

Hi Joel.
I’m using DBT cloud to control the jobs.

OK - you could maybe make something work using the API, but out of the box the UI doesn’t let you configure anything like that.

Another consideration might be to change how you’re treating your sources. If you have a use case like this, you could union your sources into a single model and then run the downstream analysis only once: Unioning identically-structured data sources

This has a lot with trigger