Skip to content Skip to sidebar Skip to footer

Python 'int32' Cannot Be Converted To A Mysql Type

In Python-MySQL, I have defined a table as follows: TABLES['clusters'] = ( 'CREATE TABLE `clusters` (' ' `pid` int(8) NOT NULL, ' ' `cluster` int(8), ' ' `cluste

Solution 1:

i had a similar problem. its probably because you're trying to insert numpy int32 and mysql cant support it. you can convert a numpy int to python int by running numpyint.item().

i would recommend checking the type of each variable you're trying to insert (type(foo)) to make sure all the values are of type that mysql can support.

Solution 2:

This is likely due to one of the sh**ty drivers for mysql. My very opinionated solution. Update to python 3 and use mysqlclient pip install mysqlclient and the problem will be solved! Voila!

Post a Comment for "Python 'int32' Cannot Be Converted To A Mysql Type"