[PyGreSQL] Idle transactions
Christoph Zwerschke
cito at online.de
Mon Oct 16 17:17:15 EDT 2006
Jeff Davis wrote:
> The pgdb module appears to leave transactions idle. My understanding is
> that this is not a good practice.
>
> In particular, any client connecting with the pgdb module basically
> prevents Slony from working. Slony waits for all active transactions to
> complete for some of its operations, and that is indefinite if using
> pgdb.
>
> Is there a reason it leaves transactions idle? I don't think psycopg2
> does that.
I assume you are already aware that PyGreSQL (DB-API2) does not
auto-commit; you have to do it manually.
But I think I see your problem: Since there is no "begin transaction"
method in DBAPI2, PyGreSQL immediately sends a "begin transaction" after
opening a connection and after each commit or rollback command, even if
you do nothing. So it can sit there for hours with an opened transaction
and do nothing.
Instead, PyGreSQL should wait and send the "begin transaction" not until
the application is trying to execute the first real DML command.
Is this what you had in mind? Should be easy to fix.
-- Christoph
More information about the PyGreSQL
mailing list