How to run multi-tag selector
Asked Answered
M

1

9

I am using dbt 0.18.1 and I follow the documentation about tags however I am curious to know how to run multi-tag selector as arguments. According to this: https://github.com/fishtown-analytics/dbt/pull/1014

Select using a mix of tags, fqns, and parent/child selectors: $ dbt run --model tag:nightly+ salesforce.*+

Unfortunately this is not really a "mix of tags".

I have tags of [mixpanel_tests, quality] and I wish to run models that have both tags included (not separated). If I run dbt run -m tag:quality -t blabla

  1. I would have executed all models that have QUALITY in the array of tags regardless if its single argument or multiple argument however I wish to run ONLY quality marked. How to do that?
  2. How do I specify 2 tags or 3 tags selector to run models with the mentioned tags (i.e mixpanel_tests, quality - but only those models that have both tags defined). More or less an AND clause rather than an OR clause.
    Hmm I hope it is clear. How to have multitag selector that executes only the combination of tags given?
Michelemichelina answered 21/12, 2020 at 15:20 Comment(0)
M
14

Check out the intersection operator. It's new in dbt v0.18, and it's for this use case exactly.

dbt run -m tag:mixpanel_tests,tag:quality
Massimiliano answered 21/12, 2020 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.