Parallel insert to postgresql with thread

Laurent Pointal laurent.pointal at laposte.net
Fri Oct 26 03:11:14 EDT 2007


Le Thu, 25 Oct 2007 13:27:40 +0200, Diez B. Roggisch a écrit :

> DB modules aren't necessarily thread-safe. Most of the times, a
> connection (and of course their cursor) can't be shared between threads.
> 
> So open a connection for each thread.
> 
> Diez

DB modules following DBAPI2 must define the following attribute:

"""
  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.
"""

http://www.python.org/dev/peps/pep-0249/



-- 
Laurent POINTAL - laurent.pointal at laposte.net



More information about the Python-list mailing list