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

Rich queries for winget packages with JMESPath #1593

Open
jantari opened this issue Oct 14, 2021 · 1 comment
Open

Rich queries for winget packages with JMESPath #1593

jantari opened this issue Oct 14, 2021 · 1 comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.

Comments

@jantari
Copy link

jantari commented Oct 14, 2021

Description of the new feature/enhancement

winget can currently query packages by:

  • id
  • name
  • moniker
  • tag
  • command

which is nice, but there will never be enough parameters and "expressiveness" within them to be able to really drill down into all package attributes and get precisely what one wants. The winget manifests are JSON or JSON-compatible YAML, so let us query the entire schema through JMESPath expressions/filters with a single parameter.

Proposed technical implementation details (optional)

JMESPath is a standard and there are many libraries available. The Azure CLI already implements it for querying azure resources, here's a MSFT article about that.

JMESPath allows to effortlessly query nested attributes, specify ranges, compare numbers, check for presence of an attribute, combine or restructure data etc. etc.. It's the one-stop solution for all package querying needs now and in the future as it evolves with the schema. For users wanting to use only basic search functionality the existing parameters will be preserved as-is.

I propose the subcommand winget filter as that would tie in nicely with #1407 because -Filter is a common parameter name for PowerShell for specifying resource-specific and resource-provider-impemented advanced filters and queries like would be the case here.

@jantari jantari added the Issue-Feature This is a feature request for the Windows Package Manager client. label Oct 14, 2021
@ghost ghost added the Needs-Triage Issue need to be triaged label Oct 14, 2021
@denelon
Copy link
Contributor

denelon commented Oct 15, 2021

@jantari this is an interesting request. We had originally called the parameter --query or -q, but today it is essentially a string we use as a filter. The current implementation uses a SQLLite database which doesn't contain all the metadata, so it's not likely to be performant with our current implementation. We would also need to look and see how this would work against a REST API. We've started discussions/design to improve the search APIs. I'll make sure the team is aware of this request to see what might be possible.

@denelon denelon removed the Needs-Triage Issue need to be triaged label Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests

2 participants