Re: Transaction persistence between execute() calls

Clodoaldo <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
2008/6/1 Federico Di Gregorio <fog-NGVKUo/i/[email protected]>:
> Il giorno dom, 01/06/2008 alle 18.56 -0300, Clodoaldo ha scritto:
>> I need that 5 queries fired by the same ajax request to a web python
>> application see the same database snapshot and i don't understand how
>> exactly to do it. Could it be like this:?
>
> This somehow already happens because the default isolation level is READ
> COMMITTED. If you need complete isolation from other queries you can use
> serializable:
>
> conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_SERIALIZABLE)
>
> Don't use BEGIN and COMMIT/ABORT in your queries unless you put psycopg
> in autocommit mode (but that's something you don't want to do).
>
> federico

Sorry i didn't tell the whole story. In the example above i placed
everything inside a connection create and a connection.close() to
simplify it. Now i see i need to say that i use a persistent
connection and cursor. So i guess i should somehow mark (begin/commit)
a transaction as the connection isn't started/closed by that request.
Is it right? If so how?

Regards, Clodoaldo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.