MySQLdb multithreaded

Greg Fortune lists at gregfortune.com
Wed May 7 14:11:55 EDT 2003


>From http://www.python.org/topics/database/DatabaseAPI-2.0.html

threadsafety 
Integer constant stating the level of thread safety the interface supports. 
Possible values are: 

0= Threads may not share the module.
1= Threads may share the module, but not connections.
2= Threads may share the module and connections.
3= Threads may share the module, connections and cursors.

MySQLdb.threadsafety == 1 for the latest version so each thread must have 
its own connection.


Greg Fortune
Fortune Solutions


Bram Stolk wrote:

> Hello,
> 
> MySQLdb package claims thread-safety.
> I am doing a lot of multithreaded queries, which give me crashes.
> single thread is OK.
> 
> Can I have multiple threads use the same connection to the db,
> or does each thread require its own connection?
> 
> I am using MySQLdb 0.9.2 on debian/x86 and python2.2.1
> 
> thx,
> 
>   Bram
> 
> 





More information about the Python-list mailing list