Re: autocommit and Django - Mailing list psycopg

From Jacob Kaplan-Moss
Subject Re: autocommit and Django
Date
Msg-id BANLkTinW_kFwMTK63_5hsuVGh+yNz7rMPA@mail.gmail.com
Whole thread Raw
In response to Re: autocommit and Django  (Federico Di Gregorio <federico.digregorio@dndg.it>)
Responses Re: autocommit and Django  (Federico Di Gregorio <federico.digregorio@dndg.it>)
List psycopg
On Wed, Jun 22, 2011 at 4:47 PM, Federico Di Gregorio
<federico.digregorio@dndg.it> wrote:
> It is just half of the fix. You can't assume that switching to
> autocommit will do an implicit ROLLBACK for you. This worked until now
> by chance (and because some drivers share the same logic and even some
> code) but will break with new drivers or when old drivers decide to
> "fix" the switch as we did for psycopg. So, IMHO, the best thing is to
> always call .rollback() before switching transaction level.

OK, thanks.

Couple more questions if you don't mind:

Are there any backwards-compatability implications here? It seems not:
if prior versions of psycopg2 implicitly issued a ROLLBACK upon
switching to autocommit then we're just making that explicit. Nobody
using an older version of psycopg2 will get burned by a "new"
ROLLBACK, right?

Second, is `conn.set_isolation_level(0)` the right invocation even in
the light of the new `set_session()` API? I'd prefer to use
`set_isolation_level` because it's backwards compatible, but if it's
going away in some future version of psycopg2 I don't want to have a
similar problem crop up later. Is `set_isolation_level` considered a
stable method?

Thanks again!

Jacob

psycopg by date:

Previous
From: Federico Di Gregorio
Date:
Subject: Re: autocommit and Django
Next
From: Federico Di Gregorio
Date:
Subject: Re: autocommit and Django