[PyGreSQL] Aborting cursor.execute statement

Christoph Zwerschke cito at online.de
Fri Feb 10 13:17:46 EST 2006


Hi Olivier,

> Is there a way of aborting the execution of an SQL statement ?

PyGreSQL and the DBAPI2 do not provide a method for this, but I think it 
would be possible to add an abort() method to the connection objection, 
which would call PQcancel(). I will try this out over the weekend 
(D'Arcy do you think this makes sense? Do we want this for 3.8 already?)

Anyway, I think you can avoid such brute force aborting. Let the 
long-running query finish in the background and simply open a new 
connection.

You should consider using PersistentPg or PooledPg from my DBUtils 
package (http://www.webwareforpython.org/DBUtils).
It provides an additional layer for multi-threaded applications that 
allows all of your threads to operate with the database as if they were 
single-threaded applications.

The documentation is currently only available as docstrings in the 
modules. A new release and better documentation of DBUtils will be 
available soon.

-- Christoph


More information about the PyGreSQL mailing list