MySQL Forums
Forum List  »  Connector/Python

MySQL Connector/Python conversion issue after 8.0.24
Posted by: Hao Gong
Date: September 20, 2021 10:42AM

Recently I have just upgraded MySQL Connector/Python to latest 8.0.26, but I found a bug for JSON column conversion issue produced after 8.0.24.

My client platform is MacOS 11.5.2 with brew installed Python 3.9.5, and the server MySQL is Percona Server Ver 5.7.30-33.

The table schema is as simple as possible:
CREATE TABLE `user` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`data` json NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=69799 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;

When I try to fetch one row, the error occurred:
...
.../lib/python3.9/site-packages/mysql/connector/conversion.py", line 589, in _STRING_to_python
return value.decode(self.charset)
AttributeError: 'str' object has no attribute 'decode'

After I downgraded to 8.0.23, everything just works. So I found something related conversion change from 8.0.24 to address "BUG#30416704: Binary columns returned as strings". I think these changes may cause this situation.

And with discovering the change in 8.0.24, I found the column protocol retuned tuple also changed, but in connection_cext.py the `_columns` info is not updated with adding the 8th tuple item.

Currently I resolved this issue with rewriting ConvertClass, is there any idea about this situation?

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
MySQL Connector/Python conversion issue after 8.0.24
September 20, 2021 10:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.