0

The data I'm trying to insert into my table has about 95k rows. So in essence I'm trying to insert 95k values using the executemany(sql, data) function.

My initial suspicion is that the number of sets of values being inserted is too much for the executemany() function to handle. Any ideas if that is indeed the cause or if there is anything else that could be causing the following error message?

Traceback (most recent call last): File "/Users/ssrikanthan/anaconda/envs/ilc-load/lib/python3.5/site-packages/mysql/connector/network.py", line 130, in send_plain self.sock.sendall(packet) BrokenPipeError: [Errno 32] Broken pipe

user4659009
  • 675
  • 2
  • 5
  • 19

1 Answers1

1

Try increasing the max_allowed_packet variable:

set global max_allowed_packet=262144000;

We can update the same from MySQL Config also as:

[mysqld]
max_allowed_packet=250M

Once updating the config you need to restart MySQL services to take effect and this is the best way to update variables. setting variables from queries is not good because values updated to defaults when MySQL services restarts.

Default value of this variable is 1MB which is not enough in some case like yours which includes large data insertion. so ,while performing large data operations like insertion,updation and dumping data from MySQL then this variable should be updated. Max limit to this variable 1GB but setting it to to 250 MB is enough in all the cases generally.

Abhishek Ginani
  • 4,511
  • 4
  • 23
  • 35