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

API for raw JSONPATH queries #28824

Closed
roji opened this issue Aug 22, 2022 · 2 comments
Closed

API for raw JSONPATH queries #28824

roji opened this issue Aug 22, 2022 · 2 comments
Labels
area-json area-query closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. type-enhancement

Comments

@roji
Copy link
Member

roji commented Aug 22, 2022

#28616 tracks translating LINQ operators inside JSON documents to JSONPATH. But just like we have raw SQL query APIs, we should also have a raw JSONPATH API, which allows the user to directly provide a JSONPATH string query and get results out. This would act as an escape hatch API for when we don't support a LINQ translation.

Ideal LINQ construct (would be possible as part of #28616):

ctx.Entity.Where(e => e.JsonThing.Track.Segments.Any(s => s.HR > 130))

Escape hatch with raw JSONPATH:

ctx.Entity.Where(e => EF.Functions.Jsonpath<Segment>(e.JsonThing, "$.track.segments[*].HR ? (@ > 130)"))

We may need different functions, one for returning an enumerable and another for returning a single thing (e.g. JSON_VALUE vs. JSON_QUERY in SQL Server).

@ajcvickers
Copy link
Member

Note from triage: @ajcvickers to test and document the wokaround.

@roji
Copy link
Member Author

roji commented Dec 11, 2022

Given that JSONPATH support is very limited across databases (see #28616 (comment)), this probably doesn't make sense as a relational feature. PostgreSQL can implement support for this as a provider-specific translation.

@roji roji removed this from the Backlog milestone Dec 11, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2022
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-json area-query closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants