排除多个模型运行

huangapple go评论53阅读模式
英文:

Exclude multiple models from run

问题

To exclude both nz_daily_cohorts and growth_scorecard when running dbt run ga4_update_set+, you can use the following command:

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

这将排除这两个模型。

英文:

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?

答案1

得分: 1

最简单的解决方法是用空格分隔排除列表,而不是用逗号分隔

dbt run ga4_update_set+ --exclude nz_daily_cohorts growth_scorecard

如果您需要重复这个任务,创建一个选择器可能更方便:

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

然后使用以下命令运行您的任务:dbt run --selector custom_job

英文:

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

huangapple
  • 本文由 发表于 2023年3月1日 14:52:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/75600390.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定