Skip site navigation (1) Skip section navigation (2)

Re: Python psycopg transaction isolation level

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Eugene Prokopiev <prokopiev(at)stc(dot)donpac(dot)ru>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Python psycopg transaction isolation level
Date: 2006-02-28 19:07:21
Message-ID: 20060228190721.GA6495@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-interfaces
On Tue, Feb 28, 2006 at 09:27:29PM +0300, Eugene Prokopiev wrote:
> connection = psycopg.connect("host="+server+" dbname="+database+" 
> user="+login+" password="+password)
> cursor_modify = connection.cursor()
> cursor_modify.execute("update messages set flag=1 where flag=0")
> connection.commit()
> 
> On running it sometimes I got:
> 
> psycopg.ProgrammingError: ERROR:  could not serialize access due to 
> concurrent update

psycopg's default isolation level is SERIALIZABLE.  I think the way
to set the isolation level to READ COMMITTED is:

connection = psycopg.connect(...)
connection.set_isolation_level(1)

You'll find more psycopg expertise on the psycopg mailing list:

http://lists.initd.org/mailman/listinfo/psycopg

-- 
Michael Fuhr

In response to

pgsql-interfaces by date

Next:From: eleinDate: 2006-03-01 00:17:51
Subject: plpython
Previous:From: Eugene ProkopievDate: 2006-02-28 18:27:29
Subject: Python psycopg transaction isolation level

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group