Exclude tag at model level

Hi! I just wanted to know if there was any way to exclude a tag at a model level. From my understanding, tags are additive, so if I have the following structure:
Top
|__ A.sql
|__ B.sql
|__ C.sql
|__ […]

And I had a tag ‘daily’ on the directory Dir, which let me know that all of the models inside Dir are to be run daily . Let’s say that For A specifically, I wanted it to be run weekly instead. If I were to add the tag ‘weekly’ in A’s config, my understanding is that it would end up with tags [‘daily’, ‘weekly’].

Is there any way in the config file that I could both add the tag ‘weekly’, but also remove the tag ‘daily’ for that model in particular?

I know there are probably workarounds I can do, but I was curious to know if tag substraction specifically was supported. Thanks!

you’re correct that tags are additive, and there’s not a method I’m aware of to exclude a dbt_project.yml tag in within a model config.

to handle this situation, you could break the models out into daily & weekly sub-directories within the current directory path they live in so that you are still able to keep the run-time tags within the dbt-project.yml. I think this approach is fairly common.

Note: @Sean Meehan originally posted this reply in Slack. It might not have transferred perfectly.

1 Like

My approach is pretty awful, but… in Airflow my logic is that if it’s not Monday, --exclude tag:weekly.
(I run my weeklies on Monday due to our reporting week being Monday through Sunday)

Note: @Renee originally posted this reply in Slack. It might not have transferred perfectly.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.