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

Relational method for checking whether a path in a JSON exists #31136

Open
roji opened this issue Jun 26, 2023 · 6 comments
Open

Relational method for checking whether a path in a JSON exists #31136

roji opened this issue Jun 26, 2023 · 6 comments
Labels
area-json area-query customer-reported good first issue This issue should be relatively straightforward to fix. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Jun 26, 2023

All relational databases support some way of checking whether a given JSON PATH exists in a JSON document. We should add a relational-level EF.Functions.JsonExists (or similar) which the different providers can translate to this.

Database Function
PG jsonb_path_exists
SQL Server JSON_PATH_EXISTS (since SQL Server 2022)
SQLite json_type (returns NULL for non-existing path, as opposed to 'null' for JSON null values)
MariaDB JSON_EXISTS
MySQL JSON_CONTAINS_PATH
Oracle JSON_EXISTS
@joelmandell
Copy link

Depending on what happens with this PR #30010. I might continue with adding those as well...

@abcdefgabcefg
Copy link

Hi @roji as I see @joelmandell PR is stuck. I'd like to try to implement this by:

  1. Create JsonExists in RelationalDbFunctionsExtensions that throws an exception
  2. Create SqlServerJsonExistTranslator
  3. Create SqliteJsonExistTranslator
  4. Register translators at SqlServerMethodCallTranslatorProvider and SqlliteMethodCallTranslatorProvider accordingly
    I believe that will support JSON PATH for SQL Server and SQLite providers, but will throw an exception for any other relational provider unless their developers implement support for one.
    Can I do it?

@joelmandell
Copy link

@abcdefgabcefg I am just waiting for feedback on that PR before I started on the other things. That's why I am lagging behind

@roji
Copy link
Member Author

roji commented Sep 17, 2023

@joelmandell oh sorry, I don't I was aware you were waiting for feedback there... we've unfortunately gone into feature freeze for 8.0 so we won't be able to merge it for that...

@abcdefgabcefg
Copy link

@roji please tell, this issue is also frozen till EF 8?

@roji
Copy link
Member Author

roji commented Sep 20, 2023

EF 8 will be out in November, and feature work on it has stopped; we're now stabilizing/fixing bugs only. Any feature PR will generally be merged for EF 9 at this point, which will come out in November 2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-json area-query customer-reported good first issue This issue should be relatively straightforward to fix. type-enhancement
Projects
None yet
Development

No branches or pull requests

4 participants