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
Json advanced support #4859
Json advanced support #4859
Conversation
@rijkvanzanten Any chance you guys could help test this with Oracle? I know you support it in Directus, so I assume you have working image on the ready :) |
I will update all tests + typings + documentation this week and I will able to run test in Oracle (I install all tools and have a new blazing fast computer \o/ ). |
@OlivierCavadenti when you complete the main work and there are only cockroach tests left, call me to this thread, I will add replacement functions for the dialect. And I suggest adding a cockroach tag and using that so I can quickly find topics that need help with cockroach. Thanks! |
Cool ! Yeah I will do that. You will be able to push on the branch (I create a branch on this repo but it's not really my goal... I will push later my other PR on my fork, like other users xD).
Really thanks for the suggestion, I will do that. |
Totally! We've based our docker-compose setup on the one included in the knex tests, and altered it slightly to use a smaller image. Not sure how that affects the Knex test suite necessarily, but the image itself runs fine and allows for easy (local) debugging: # In docker-compose.yaml
# ...
oracle:
image: quillbuilduser/oracle-18-xe-micro-sq
ports:
- 1521:1521
environment:
- OPATCH_JRE_MEMORY_OPTIONS=-Xms128m -Xmx256m -XX:PermSize=16m -XX:MaxPermSize=32m -Xss1m
- ORACLE_ALLOW_REMOTE=true
shm_size: '1gb' # more like smh-size ammirite 🥁
# ... One thing to note: we've had a lot of trouble getting NodeJS to connect properly to OracleDB in a containerized environment though, due to Oracle's dependency on their |
@OlivierCavadenti I am thinking about releasing 1.0.0 after this lands, we have plenty of good stuff lined up already. Do you feel like anything else should make the cut too? |
No, I will finish this and work to polish checks constraints (I also have castTo functions in the pipe) but I think is better to stabilize all the stuff. And Json Indexes will be in a second part I think |
5dd3de0
to
1b0eb65
Compare
I add all missing unit tests (finally, integration seems good) and update index.d.ts (I just need to add json manipulations functions, I am not familiar with complex TypeScript index.d.ts types so I will update later). I made some tests on Oracle and unfortunaly I have ' ORA-40454: path expression not a literal' errors (json path is a classic string parameters... need to investigate) and other syntax errors for other functions (json_transform is introduced in Oracle 21c...). |
@intech can you check cockroach tests plz ? |
@kibertoad I push typings so I think I am done with this first version. I will push documentation in 1 or 2 days. |
c09f17a
to
47e3a0b
Compare
Yes! How do we deal with the |
I made a generic '_jsonExtract' function in querycompiler that take the name of json function to query and params (column, path, value,...). For example Maybe specify jsonExtract and override _jsonExtract function in querycompiler that will transform a jsonPath from 'params.path' variable into '->' expression (like toPathForJson functions for RedShift and PG in index.js files). If we cant transform jsonPath into '->' notation, we will raise an error. |
# Conflicts: # lib/dialects/oracledb/query/oracledb-querycompiler.js
@intech I implement method to convert json path to json arrow notation to extract data from json in cockroach db. I just need to fix join json path and it will be done. |
@OlivierCavadenti I was busy and did not have time to do it yet. The cockroach has a function |
No problem, I am free today I will rework that today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Released in 1.0.1. |
I start #1337 1 month ago and after some iterations and pauses, I push a draft if anyone want to start a review, it's quite big.
JSON support is quite challenging, because all database have support of JSON, but in really different ways (syntax, cast, paths...)
Implemented :
one extraction way (json column, jsonpath, alias):
multiple extraction way (pretty powerful):
Json set, json insert, json remove (alias support)
All extraction + manipulation functions are made to be used like 'select' or by nested like :
It's possible to join tables by json value from json columns like :