Replies: 1 comment 1 reply
-
|
The problem you are experiencing is that there are two legitimate possibilites: binding a NULL value and binding a not NULL value that is a JSON representation of NULL. The driver cannot know which one is intended! There is a method available (encode_oson) that you can use to enforce the encoding of the None value as OSON (Oracle's binary JSON implementation) and you can bind the encoded bytes directly. Maybe that will help? If SQLAlchemy knows that the NULL value supplied is supposed to be a JSON value, it could use this method to inform the driver accordingly. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hey there -
JSON supports a string "null" that typically is what the Python json.dumps() encoder produces:
over at the table at https://python-oracledb.readthedocs.io/en/latest/user_guide/json_data_type.html#in-bind-type-mapping , it's a little bit ambiguous if oracledb's DB_TYPE_JSON encoder treats None as SQL NULL or as json "null". However, a test script as seen below indicates it treats None as SQL NULL. This is fine but as SQLAlchemy supports two different "none as NULL" modes for JSON, I think we're going to have to stick to using our own JSON serializer (and probably just add Decimal support to mirror oracledb).
Beta Was this translation helpful? Give feedback.
All reactions