You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyMySQL's behaviour should be more appropriate imho.
To Reproduce
Have a SqlAlchemy Model with JSON column and try to create a new record.
Expected behavior
Should able to create record.
Logs/tracebacks
OperationalError('(pymysql.err.OperationalError) (3144, "Cannot create a JSON value from a string with CHARACTER SET \'binary\'.")')
'INSERT INTO platform_configurations (platform_name, configuration, id) VALUES (%s, %s, %s)'
('string', b'{"additionalProp1":"string","additionalProp2":"string","additionalProp3":"string"}', '01HEN04BMEKFV1SH55084F9JWX')
Python Version
$ python --version3.11.6
aiomysql Version
$ python -m pip show aiomysqlName: aiomysqlVersion: 0.2.0Summary: MySQL driver for asyncio.Home-page: https://github.com/aio-libs/aiomysqlAuthor: Nikolay NovikAuthor-email: [email protected]License: MITLocation: /usr/local/lib/python3.11/site-packagesRequires: PyMySQLRequired-by:
PyMySQL Version
$ python -m pip show PyMySQLName: PyMySQLVersion: 1.1.0Summary: Pure Python MySQL DriverHome-page: Author: Author-email: Inada Naoki <[email protected]>, Yutaka Matsubara <[email protected]>License: MIT LicenseLocation: /usr/local/lib/python3.11/site-packagesRequires: Required-by: aiomysql
Describe the bug
Escaping bytes with _binary prefix causes error on MySQL.
SqlAlchemy doc mentions it:
https://docs.sqlalchemy.org/en/20/dialects/mysql.html#dealing-with-binary-data-warnings-and-unicode
Also pymysql takes _binary_prefix as optional parameter with default value False and adds _binary prefix if true.
https://github.com/PyMySQL/PyMySQL/blob/c1d8063759a4a3968b0f7907e098554d9a8ad552/pymysql/connections.py#L515C21-L515C35
PyMySQL's behaviour should be more appropriate imho.
To Reproduce
Have a SqlAlchemy Model with JSON column and try to create a new record.
Expected behavior
Should able to create record.
Logs/tracebacks
Python Version
aiomysql Version
PyMySQL Version
SQLAlchemy Version
OS
Alpine linux devcontainer environment
Database type and version
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: