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-1869] Turn --output-keys into MultiOption #6676

Closed
Tracked by #6706
jtcohen6 opened this issue Jan 19, 2023 · 0 comments · Fixed by #7068
Closed
Tracked by #6706

[CT-1869] Turn --output-keys into MultiOption #6676

jtcohen6 opened this issue Jan 19, 2023 · 0 comments · Fixed by #7068
Assignees
Labels
cli python_api Issues related to dbtRunner Python entry point

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Jan 19, 2023

Current state

Users can supply --output-keys to customize the set of information returned by dbt list:

$ dbt ls --output json --output-keys name,resource_type,description
{"name": "my_incremental_model", "resource_type": "model", "description": "cool docs bro"}
{"name": "my_seed", "resource_type": "seed", "description": ""}

The type of --output-keys is a string. I've always thought the string needed to be a comma-delimited list, but really it could be ... anything? ... so long as the string contains the relevant key name:

output_keys = click.option(
"--output-keys", envvar=None, help="TODO: No current help text", type=click.STRING
)

$ dbt ls --output json --output-keys nameNotACommaresource_type==blabladescription
{"name": "my_incremental_model", "resource_type": "model", "description": "cool docs bro"}
{"name": "my_seed", "resource_type": "seed", "description": ""}

Proposal

We just (#6641) added a MultiOption option to support params like --select, that take multiple space-limited arguments:

$ dbt run --select thing_a thing_b --another-flag ...

This would be more consistent, and allow us to treat the type of output_keys as a list (right?) for programmatic invocations:

$ dbt ls --output json --output-keys name resource_type description

Looks like that's even how we've been documenting it (incorrectly)! https://docs.getdbt.com/reference/commands/list

Add a test

We also need an automated test for dbt list --output json --output-keys!

@jtcohen6 jtcohen6 added python_api Issues related to dbtRunner Python entry point cli Team:Execution labels Jan 19, 2023
@github-actions github-actions bot changed the title Turn --output-keys into MultiOption [CT-1869] Turn --output-keys into MultiOption Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli python_api Issues related to dbtRunner Python entry point
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants