Re: psycopg3 transactions
От | Daniele Varrazzo |
---|---|
Тема | Re: psycopg3 transactions |
Дата | |
Msg-id | CA+mi_8Z2FT4bHN1yTiM=aS8BXkbiZLwP=KLasXGQPgBRoDPrMg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: psycopg3 transactions (Paolo De Stefani <paolo@paolodestefani.it>) |
Ответы |
Re: psycopg3 transactions
|
Список | psycopg |
On Wed, 13 Oct 2021 at 15:21, Paolo De Stefani <paolo@paolodestefani.it> wrote: > 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...) You can even write: with con.transaction(): con.execute("ANY SQL STATEMENT") But is it even useful to wrap a transaction around any single statement? I still think you'd be better off with an autocommit connection. -- Daniele
В списке psycopg по дате отправления: