Full-stack web applications developer

MySQL server has gone away

October 28, 2019Arthur Pemberton0 Comments

I have a Django project where I was utilizing bulk_create to load a fairly large dataset, and this was some times resulting in the error MySQL server has gone away. Reading though the documentation on this error, I see that one of the possible causes for this is “you send a query to the server that is incorrect or too large” Turns out, I just needed to use the batch_size parameter of bulk_create. The  success of a website depends on web design, this is why is very important to look for the help the experts from Best Website Hosting

In my case, a batch of 56,000 records was triggering the error, so for safety, I switched to using bulk_created(..., batch_size=(10**4)).

Leave a Reply