I'm trying to use MySQL to store a series of matrices and dictionaries. I'm using python 3.
To do this, I'm serializing the matrices with .dumps() and placing my dictionaries into np.arrays and serializing them too.
This is what I'm trying:
matriz_entry = serie.pvalue_matrix.dumps()
sinais_entry = np.array([serie.sinais]).dumps()
c.execute('INSERT INTO test_table (time, sinais, matriz) VALUES (%s,%s,%s)',
(time.time(), sinais_entry, matriz_entry))
This error is returned: `pymysql.err.InternalError: (1366, "Incorrect string value: '\x80\x02cnum...' for column 'sinais' at row 1")
This is my MySQL table:
mysql> DESC test_table;
+--------+----------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+----------------+------+-----+---------+-------+
| time | varchar(100) | YES | | NULL | |
| sinais | varchar(13000) | YES | | NULL | |
| matriz | varchar(2000) | YES | | NULL | |
+--------+----------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
I'm actually new to SQL and I don't know if serializing an object is good practice since I may be exceeding the maximum row length of a table (the dictionary serialized is over 12000 characters long).
I've also tried using the type TEXT instead of VARCHAR(), but that won't work either.
Please request any relevant additional information.