Warn when selector contains unaccompanied graph operator#12776
Warn when selector contains unaccompanied graph operator#12776viniciusnunest wants to merge 2 commits into
Conversation
Detect bare graph operators (+, @, 1+1) at parse time and emit a NoNodesForSelectionCriteria warning instead of silently accepting them. Fixes dbt-labs#10388
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: vinicius.
|
1c28b61 to
27542d7
Compare
|
Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA. In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR. CLA has not been signed by users: @viniciusnunest |
Resolves #10388
Problem
If you run something like
dbt list --select +ordbt list --select 1+1,dbt just accepts it silently and gives you unexpected results. Usually nothing,
sometimes everything downstream. No warning, no hint that the selector is wrong.
The original report was from someone who put an accidental space in an intersection
selector:
model+,+ other_model. That space caused+ other_modelto be parsedas just
+.Solution
Added detection for these "unaccompanied" graph operators in
SelectionCriteria.from_single_spec. When one is found, it fires aNoNodesForSelectionCriteriawarning, the same warning dbt already uses whena selector matches zero nodes. Felt like the right fit instead of creating a
whole new event type.
A graph operator counts as unaccompanied when:
+or@but no actual value (+,@,1+)a model name (
1+1,+2,2+3)Anything with letters, paths, or colons in the value passes through without
warning. So
+mymodel,tag:my_tag, even+1abcare all fine.Checklist