I wrote this function which is run without any error.
def insertRows(self, query,data):
self.cursor.executemany(query,data)
self.connection.commit()
But, I got the following error when I run my code on another computer for same data.
MySQL Error [2006]: MySQL server has gone away
Traceback (most recent call last):
File "main.py", line 157, in <module>
writePostingLists(lst)
File "main.py", line 32, in writePostingLists
mydb.insertKNNIndex(postingLists,tabelName)
File "/home/pythonCode/Doc2Vec_Annoy/KNN/MySQLRepository.py", line 78, in insertKNNIndex
self.insertRows(query,inputList)
File "/home/pythonCode/Doc2Vec_Annoy/KNN/MySQLRepository.py", line 31, in insertRows
self.connection.rollback()
_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
I found out that the problem is the length of list that I give to executemany function.
The above code is executed without any problem when the length of data is less than 300.
How can I solve this problem? Is it related to setting of MySQl?