[Twisted-Python] runQuery isolation patch

Federico Di Gregorio fog at initd.org
Thu Mar 6 06:50:06 EST 2003

runQuery has a problem when used with databases with transactions and
high isolation levels (like postgresql+psycopg): it never closes the
transaction leaving threads using that connection from the pool
completely isolated from changes to the database. the solution is to
call rollback() on the connection just after the query has been

simple patch follows:

--- adbapi.py-old       2003-03-06 12:48:02.000000000 +0100
+++ adbapi.py   2003-03-06 12:49:01.000000000 +0100
@@ -97,6 +97,7 @@
         apply(curs.execute, args, kw)
         result = curs.fetchall()
+       conn.rollback()
         return result
     def _runOperation(self, args, kw):

Federico Di Gregorio
Debian GNU/Linux Developer                                fog at debian.org
INIT.D Developer                                           fog at initd.org
  Gli esseri umani, a volte, sono destinati, per il solo fatto di
   esistere, a fare del male a qualcuno.              -- Haruki Murakami
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030306/35099af2/attachment.pgp 

More information about the Twisted-Python mailing list