Re: psycopg3 transactions - Mailing list psycopg

From Paolo De Stefani
Subject Re: psycopg3 transactions
Date
Msg-id 6683df3e65fe961aa478e61db7ad687d@paolodestefani.it
Whole thread Raw
In response to Re: psycopg3 transactions  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: psycopg3 transactions  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Re: psycopg3 transactions  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
Il 13/10/2021 13:50 Daniele Varrazzo ha scritto:
> 
> I think we can improve the documentation there by extending more about
> the effects of the interaction between DBAPI transactions and the
> transaction() blocks. And things are definitely more intuitive if
> transaction() is used in autocommit: we might want to advise people to
> do that.
> 
> Suggestions are welcome.
> 
> -- Daniele

I think the problem is only for people like me that come from psycopg2.

I was used to wrote a "with con.cursor() as cur:" that now i hato to 
replace with:

with con.transaction():
     with con.cursor() as cur:
         cur.execute("ANY SQL STATEMENT")

and everything works as expected (or i expect...)

Thanks for clarifying

-- 
Paolo De Stefani



psycopg by date:

Previous
From: "Lembark, Steven"
Date:
Subject: Using standard SQL placeholders in PG
Next
From: Daniele Varrazzo
Date:
Subject: Re: psycopg3 transactions