Re: Transaction control overhauling - Mailing list psycopg

From Federico Di Gregorio
Subject Re: Transaction control overhauling
Date
Msg-id 4DCBCED5.1010607@dndg.it
Whole thread Raw
In response to Re: Transaction control overhauling  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Transaction control overhauling  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
On 12/05/11 13:57, Magnus Hagander wrote:
>> II. add a method conn.set_transaction(isolation_level=None,
>> > read_only=None, deferrable=None) allowing to change one or more of the
>> > transaction settings. Calling the method would terminate the current
>> > transaction and put the new settings in place. Note that there are
>> > several ways for implementing this:
> Ugh. Big -1 on the "terminate current transaction". First of all, I
> *assume* you mean ROLLBACK and not COMMIT. But even so, I think it's a
> much better idea to raise a local exception when trying to change it
> while inside a transaction.
>

That makes sense. Currently psycopg keeps track of the current
transaction level to be able to decide if to terminare the transaction
(with a ROLLBACK) or not. But that's less than optimal because the
result of set_transaction_isolation() depends both on internal state and
issued queries. Much much better to just raise an exception if inside a
transaction.

federico

--
Federico Di Gregorio                         federico.digregorio@dndg.it
Studio Associato Di Nunzio e Di Gregorio                  http://dndg.it
 The only thing I see is if you are pumping so much data into the
  database all the time when do you expect to look at it?
                                                        -- Charlie Clark

psycopg by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Transaction control overhauling
Next
From: Daniele Varrazzo
Date:
Subject: Re: Transaction control overhauling