Improve dashboard and card parameter workflows#30
Merged
Conversation
Add `card params` and `dashboard params list` so users can discover the parameters a saved question or dashboard accepts before running it, instead of digging through `card get --full` JSON or guessing IDs. Failed parameterized runs now surface a ParameterizedQueryError carrying the exact discovery command to run next (`mb-cli card params <id>` or `mb-cli dashboard params list <id>`), shown in both text and JSON error output. Metabase rejects invalid card parameters with a 500 rather than a 400, so this keys off whether the caller supplied parameters rather than the status code. Closes #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #14. Running parameterized cards and dashboard cards previously required knowing parameter IDs and values up front, with no way to discover them. This adds discovery commands and makes failed runs point at the exact command to inspect valid parameters.
Changes
card params <id>— lists the parameters a saved question accepts (from native template tags).cardandsnippettemplate tags are excluded since they reference other queries rather than taking a user value. Table output ends with a ready-to-editcard run ... --param name=<value>line.dashboard params list <dashboard-id>— lists a dashboard's parameters, types, and how many cards each filters; completes thedashboard paramsgroup (list/values/search).ParameterizedQueryErrorcarrying the precise discovery command (mb-cli card params <id>/mb-cli dashboard params list <id>), shown in both text and--error-format jsonoutput.--paramflags rather than the status code.Testing
make fmt,make vet,make build,make testall cleancard runanddashboard run-cardcard params,card run(valid + invalid params),dashboard params list,dashboard run-cardinvalid-param pathChangelog
Entry added under
## [Unreleased].