HOME       >>       Programming

Python Mysqldb Threading


I have a small application that spawns several threads which produce output that I insert into the database. The output from one thread is an array and I use


In the beginning I was always getting the mysql error

lock time exceeded try to restart the transaction

...I managed to resolve this issue - partially it was coming from IDLE editor and the open python shell - seems they were not unlocking the tables while open - so in order for my code to run I use to run it from the shell ...
The next step to handle this was to lock the table before every insert - despite that each thread is using its own mysql connection ...

At this stage the error still occurs - and this results in loss of data and CPU usage....

Any exerience related to python and mysqldb and executemany and threading will be greatly appreciated!


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.