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-3095] [Bug] MultiOption CLI option should accept quoted strings with multiple options #8598

Closed
2 tasks done
Tracked by #8600
jtcohen6 opened this issue Sep 8, 2023 · 0 comments · Fixed by #8665
Closed
2 tasks done
Tracked by #8600

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 8, 2023

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

This works for --select and --exclude because the splitting happens during the selection spec comprehension (I think):

$ dbt -q ls --select "stg_orders stg_products"

But it does not work for --resource-type or --output-keys:

$ dbt -q ls --resource-type "model semantic_model"
Usage: dbt ls [OPTIONS]
Try 'dbt ls -h' for help.

Error: Invalid value for '--resource-types' / '--resource-type': 'model semantic_model' is not one of 'metric', 'semantic_model', 'source', 'analysis', 'model', 'test', 'exposure', 'snapshot', 'seed', 'default', 'all'.
$ dbt -q ls --resource-type semantic_model --output json --output-keys "name fqn"
{}
{}
{}
{}
{}
$ dbt -q ls --resource-type semantic_model --output json --output-keys name fqn
{"name": "customers", "fqn": ["jaffle_shop", "marts", "customers"]}
{"name": "locations", "fqn": ["jaffle_shop", "staging", "locations"]}
{"name": "order_item", "fqn": ["jaffle_shop", "marts", "order_item"]}
{"name": "orders", "fqn": ["jaffle_shop", "marts", "orders"]}
{"name": "stg_products", "fqn": ["jaffle_shop", "staging", "stg_products"]}

Expected Behavior

For maximum flexibility, MultiOption params should accept all of the following:

$ dbt --option arg1 arg2
$ dbt --option "arg1 arg2"
$ dbt --option arg1 --option arg2

While (1) is what we've historically documented/recommended, it is not POSIX standard. (2) and (3) are significantly more common, and easier to support in other CLIs. The quoted option (2) in particular is easier to read as the number of arguments increases.

Steps To Reproduce

Pass a quoted string with multiple arguments into dbt list --output-keys or dbt list --resource-types

Relevant log output

No response

Environment

- OS: 13.4.1
- Python: Python 3.10.11
- dbt: 1.7.0-b2 (main)

Which database adapter are you using with dbt?

No response

Additional Context

@github-actions github-actions bot changed the title [Bug] MultiOption CLI option should accept quoted strings with multiple options [CT-3095] [Bug] MultiOption CLI option should accept quoted strings with multiple options Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants