dbt Cloud run in deployment only one model of job

Hi all,

I am trying to run one model in production and outside of the Job (set of models) but can’t figure out how it is possible.

I have two environments on dbt Cloud:

  • development with the target name ‘dev’ and the bigquery dataset ‘analytics_dev’
  • deployment with target name ‘default’ and bigquery dataset 'analytics

I have modified a model in the development environment and it does return the expected result by running ‘dbt run --select model_name’ on the command line. The code modification was merged to the git repo.

I would now like to deploy it in production.
This model is part of a Job that runs a set of models.

The problem is that I don’t want to run all the models in the Job. I only want to run the modified model.
Is there any way through the command line (or whatever) to run only one model from the models in the job in production?

I tried ‘dbt run --select model_name --target default’ but the target name is ignored since it is launched in the development environment.

However I know that this command would work with dbt CLI if profiles.yml is configured properly. I therefore imagine that it is somewhat also possible in dbt Cloud

Best,

Hey Yoni!

Deployment runs can only run through the scheduler, not the command line inside of the IDE.

What I normally do is have a Job called something like Adhoc Runs and edit its command when I need to do this sort of one-off refresh.

The other thing you could do is set up a job which takes advantage of deferral and the state:modified selector. Our docs mostly refer to this in a CI context, but you can use it in the same way for an adhoc production job which compares itself to your daily production run.

Defining an adhoc job is exactly what I was planning to do but it seemed a bit time-consuming each time.
I will study the second solution
Thank you for your help Joel!

1 Like