-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Resource selection: allow to specify intersection with union #10596
Comments
Hi @jaklan thanks for opening! I haven't tested this, but I wonder if something like |
@graciegoheen it will, but in our case the problem is - in our Airflow DbtOperator we allow end-users to specify their selectors like
but currently we need custom logic to parse
which creates additional overhead. So it's not "undoable", but affecting user experience. And as mentioned above - it works for YAML selectors, so there's inconsistency here (if there's really no CLI syntax to enforce such intersection). |
It seems to me like we would need a grouping/priority operator. Parentheses is probably what would make the most sense. So: |
With the
No need for parentheses, as the YAML selector itself would act as the grouping operator. And you might be able to create the selector dynamically before running dbt. It could be as simple as injecting something like this in - name: selector_to_run_now
definition: <selector specified by user> Just need to be careful to get the indentation right. 😅 Or do a string replace of a placeholder value, that would probably be much easier (easy to do even with And then: And another alternative would be this one, 💡 Edit: Actually, a Like this: - name: everything_that_is_not_in_this_package
definition:
intersection:
- '*'
- exclude:
- package:this # Or my_project_name also works here Or actually, you should already be able to create a final selector to run which would be: - name: final_selector_to_run_now
definition:
intersection:
- method: selector
value: selector_to_run_now
- package:this |
@mroy-seedbox these are just 2 different use-cases. We definitely need support for parentheses, which you could utilise with any method (incl. proposed |
It sounds like But yeah, I too have often wished for some kind of grouping/priority operator (i.e. parentheses). Otherwise, we have to repeat ourselves (or worse and do parsing, as in you case), and it sucks. 😞 |
Is this your first time submitting a feature request?
Describe the feature
Currently I don't see a way to define an intersection with union when specifying resources using
--select
.Example:
model_a1
withouttag:test
model_a2
withtag:test
model_a3
withouttag:test
model_b1
- doesn't existHere intersection is only applied to
model_a1
, quotation marks don't prioritise union over intersection.However, selectors seem to work:
In that case we get:
The text was updated successfully, but these errors were encountered: