Exclude multiple models from run
Asked Answered
K

1

5

When running dbt with descendants, I would like to exclude two models. I can exclude one model like so:

dbt run ga4_update_set+ --exclude nz_daily_cohorts

The above works as expected.

I tried the following to exclude multiple models.

dbt run ga4_update_set+ --exclude nz_daily_cohorts,growth_scorecard

In this case neither nz_daily_cohorts nor growth_scorecard were excluded.

Then tried:

dbt run ga4_update_set+ --exclude nz_daily_cohorts --exclude growth_scorecard

Again, in this case neither nz_daily_cohorts nor growth_scorecard were excluded.

How can I run dbt run ga4_update_set+ but also exclude both nz_daily_cohorts and growth_scorecard?

Kellda answered 1/3, 2023 at 6:52 Comment(0)
C
6

The easiest solution is to just space-delimit your exclude list instead of comma-delimiting

dbt run ga4_update_set+ --exclude nz_daily_cohorts growth_scorecard

If you need to repeat this job, it may be more convenient to create a selector:

selectors:
  - name: custom_job
    definition:
      union:
        - method: fqn
          value: ga4_update_set
          children: true
        - exclude:
            - method: fqn
              value: nz_daily_cohorts
            - method: fqn
              value: growth_scorecard

Then run your command with dbt run --selector custom_job

Continuance answered 1/3, 2023 at 17:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.