Properly getting blobs from mysql database with mysql connector in python
问题 When executing the following code: import mysql.connector connection = mysql.connector.connect(...) # connection params here cursor = connection.cursor() cursor.execute('create table test_table(value blob)') cursor.execute('insert into test_table values (_binary %s)', (np.random.sample(10000).astype('float').tobytes(),)) cursor.execute('select * from test_table') cursor.fetchall() I get the following error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf7 in position 1: invalid start