I am trying to create a CI job which runs when a model change has been deployed to the staging ENV. The command I am using is dbt build --select state:modified+. The challenge I am facing is the CI job runs all the models instead of only the model that is edited on the github PR. Is there something I am missing?
Is this core or cloud? dbt Cloud CI jobs should have deferral enabled in the job settings. If it’s core, then you’ll need to pass a path to a previous manifest using the --state
flag in order to perform a comparison. You’ll need the --defer
flag as well in core.
If you want to run only the affected models you need to remove the +
from you command as that will run all downstream models of affected ones as well
dbt build --select state:modified
Note: @Johann De Wet
originally posted this reply in Slack. It might not have transferred perfectly.
I tried removing the + at the end of the statement but it still runs all models when making change to a single one.
I see you are deferring to your staging environment. Are you running any jobs in there so there is a fresh state to compare to? Normally you would compare against production to identify any changed between dev and prod
Note: @Johann De Wet
originally posted this reply in Slack. It might not have transferred perfectly.