Aw: Re: psycopg3 transactions

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: Daniel Fortunov <postgresql(at)danielfortunov(dot)com>
Cc: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, Paolo De Stefani <paolo(at)paolodestefani(dot)it>, Psycopg <psycopg(at)postgresql(dot)org>
Subject: Aw: Re: psycopg3 transactions
Date: 2021-10-14 10:05:03
Message-ID: trinity-cf9ddf31-623c-4512-beff-cf6d6d0116b8-1634205902640@3c-app-gmx-bs43
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

>My conclusion is that the only sane thing to do is:
>1. Only ever create connections in autocommit mode.
>2. Only ever use `with connection.transaction()` to control transactions.
>3. Forget that `connection.commit()` and `connection.rollback()` exist, and never use them.

What if you need to rollback a hitherto valid transaction ?

Transactions are there for a reason. It seems best to explicitely use them ?

Karsten

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Daniel Fortunov 2021-10-14 11:08:11 Re: Re: psycopg3 transactions
Previous Message Reuben Rissler 2021-10-14 00:14:53 Re: psycopg3 transactions