We kwamen hetzelfde probleem tegen dat BLOB's per ongeluk werden teruggelezen als UTF-8-strings met MySQL 8.0.13, mysql-connector-python 8.0.13 en sqlalchemy 1.2.14.
Wat de truc voor ons was, was het inschakelen van de use_pure
optie van MySQL Connector
. De standaard van use_pure
was veranderd in 8.0.11 met als nieuwe standaard het gebruik van de C-extensie. Dus zetten we de optie terug:
create_engine(uri, connect_args={'use_pure': True}, ...)
Details van onze fout- en stacktracering:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9c in position 1: invalid start byte
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
....
File "/usr/local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 272, in execute
self._handle_result(result)
File "/usr/local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 163, in _handle_result
self._handle_resultset()
File "/usr/local/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 651, in _handle_resultset
self._rows = self._cnx.get_rows()[0]
File "/usr/local/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 273, in get_rows
row = self._cmysql.fetch_row()
SystemError: <built-in method fetch_row of _mysql_connector.MySQL object at 0x5627dcfdf9f0> returned a result with an error set