Skip to content
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

[CT-1981] Issue when passing --select and --model to a command together #6800

Closed
Tracked by #6706
aranke opened this issue Jan 31, 2023 · 3 comments · Fixed by #7169
Closed
Tracked by #6706

[CT-1981] Issue when passing --select and --model to a command together #6800

aranke opened this issue Jan 31, 2023 · 3 comments · Fixed by #7169
Assignees
Labels
cli tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality

Comments

@aranke
Copy link
Member

aranke commented Jan 31, 2023

Did some manual testing by locally overwriting a command that accepts the new select (--select, --model) alias command with print(ctx.obj["flags"].SELECT) and found some issues when passing --select and --model to a command together.

The options are not treated as mutually exclusive via MultiOption and the resulting flags.SELECT value is clobbered by the value from the last alias option:

❯ python3 core/dbt/cli/main.py docs generate --select model_a model_b  --model model_c
('model_c',)

❯ python3 core/dbt/cli/main.py docs generate --model model_c --select model_a model_b
('model_a', 'model_b')

This was unexpected behaviour to me, but for better or for worse this is also how main's parsing currently works (printing args.select and exiting on main to test):

❯ dbt docs generate --select model_a model_b --model model_c
['model_c']
❯ dbt docs generate --select model_a model_b --model model_c
['model_c']
❯ dbt docs generate --model model_c --select model_a model_b 
['model_a', 'model_b']

We should probably open an issue to document this behaviour and investigate a fix that gets us --select/--model option mutual exclusivity if possible. But given that it's the current behaviour on main I don't see it as pressing to fix as part of this PR.

Originally posted by @MichelleArk in #6787 (comment)

@github-actions github-actions bot changed the title Did some manual testing by locally overwriting a command that accepts the new select (--select, --model) alias command with print(ctx.obj["flags"].SELECT) and found some issues when passing --select and --model to a command together. [CT-1981] Did some manual testing by locally overwriting a command that accepts the new select (--select, --model) alias command with print(ctx.obj["flags"].SELECT) and found some issues when passing --select and --model to a command together. Jan 31, 2023
@aranke aranke changed the title [CT-1981] Did some manual testing by locally overwriting a command that accepts the new select (--select, --model) alias command with print(ctx.obj["flags"].SELECT) and found some issues when passing --select and --model to a command together. [CT-1981] Issue when passing --select and --model to a command together Jan 31, 2023
@jtcohen6 jtcohen6 added the tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality label Feb 3, 2023
@iknox-fa
Copy link
Contributor

iknox-fa commented Feb 6, 2023

@JerCo can we close this as a won't fix due to the fact that we want to deprecate --model?

@aranke
Copy link
Member Author

aranke commented Feb 6, 2023

Tagging the right Jerco, @jtcohen6.

@iknox-fa
Copy link
Contributor

iknox-fa commented Feb 6, 2023

sigh I have done this more times than I'd like to admit.
Thanks @aranke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants