-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Added JSON field support #428
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
Conversation
Without this PR, people can catche exceptins while decoding JSON. And people can use faster Additionally, there is asymmetry issue. So I don't want to convert JSON type in driver level. |
Well, I can remove the convert code, but still the library need the definition of Also, while doing |
Yes, you should pass JSON to PyMySQL in string. |
Then, your PR is wrong since |
I have this exact problem. @methane , how non-ascii JSON can be handled without this PR? This is the current code:
step2_details variable is: Error thrown:
|
Actually my problem seems to be related to SQLAlchemy, because I managed to update the JSON field just using standard SQL.
|
As of MySQL 5.7.8, MySQL supports a native JSON field type, I've added support for this field. It gets automatically unpacked using
json.loads
, and falls back to{}
in case of corrupted JSON.According to this the
JSON
field type has codeMYSQL_TYPE_JSON=245
.Thank you!