-
Notifications
You must be signed in to change notification settings - Fork 947
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
Understanding the use of --selector and --models together #803
Comments
@rahul-ve Thanks for opening. The current behavior is exactly as you surmised: when We might want to raise an exception if both Is adding that exception something you'd be interested in contributing? :) You're also hinting at a more clever/complex behavior than dbt is capable of today: combining a yaml selector with runtime "overrides" in the form of But I'm inclined to prefer the approach you offer:
I'd rather not mix CLI + versioned selection logic, and instead recommend extending existing selectors, e.g. by means of yaml anchors to stay DRY: selectors:
- name: my_standard_selection
definition: &standard-selection
method: fqn
value: "*"
exclude: ...
- name: my_ci_logic
description: "For use in CI"
definition:
union:
- *standard-selection
- one_model |
@jtcohen6 Thanks for the prompt reply!
Thanks for confirming, updating the docs will clear the confusion. I can contribute if the docs are open for public submissions.
May be a warning, exception might be jarring for something like this and unnecessarily makes the user make another hop, I think a warning will achieve the same effect.
Happy to contribute, will have a look at your contributing guide. Just to provide some context... We currently use We have to evaluate state option, but I think it will be a replacement for the The above does not work when we also have
I don't think any change to the functionality is warranted, clarifying the docs will address the issue of confusion. |
@rahul-ve Really appreciate the detailed response!
I'm going to transfer this issue to the docs.getdbt.com repo. I think a quick change to the node selection overview or page on yaml selectors will do the trick. |
* Switch --models to --select * BQ snapshot config aliases * Configurable postgres connect timeout * Add list --output-keys. Add list RPC method * Adapter unique_field dbt-labs/dbt-core#3796 * PR feedback: -s replaces -m * Add BQ execution_project * Add default property for yaml selectors * Update migration guide. New fields in sources.json * Test where config macro * Dispatch for global macros * Update build details * Some self review * Greedy flag/property for test selection * Resolve #803 while we're here * Fix broken link typo
* Switch --models to --select * BQ snapshot config aliases * Configurable postgres connect timeout * Add list --output-keys. Add list RPC method * Adapter unique_field dbt-labs/dbt-core#3796 * PR feedback: -s replaces -m * Add BQ execution_project * Add default property for yaml selectors * Update migration guide. New fields in sources.json * Test where config macro * Dispatch for global macros * Update build details * Some self review * Greedy flag/property for test selection * Resolve #803 while we're here * Fix broken link typo
@jtcohen6 on your suggestion above using anchors, do you know how to dynamically set the context: we have two default selector definitions (depending on which environment) i.e. each selector definition has have the default rule default: "{{ target.type == 'snowflake' | as_bool }}" so there are two ...
- name: my_ci_logic
description: "For use in CI"
definition:
union:
- "*{{ target.type }}" i'm also unable to set variables at the top level variables:
- name: dynamic_default_selection_name
value: "{{ target.type }}"
...
- name: my_ci_logic
description: "For use in CI"
definition:
union:
- *$(dynamic_default_selection_name) |
Hi team,
I am referring to the doc about node selection, https://docs.getdbt.com/reference/node-selection/syntax
Based on my testing locally, looks like if both
--models
and--selector
options are passed in,--models
options is being ignored This is not clearly documented hence asking. Is this the expected behavior?We have a situation where we have a selector defined to exclude a bunch of models but we wanted to select a particular model from the excluded list to also be run at times. This can be achieved by modifying the selector using union, exclude logic but we only want the excluded model to run based on some logic during CI run.
Thanks!
The text was updated successfully, but these errors were encountered: