public inbox for [email protected]  
help / color / mirror / Atom feed
From: Karsten Hilbert <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: Daniel Fortunov <[email protected]>
Cc: Daniele Varrazzo <[email protected]>
Cc: Paolo De Stefani <[email protected]>
Cc: Psycopg <[email protected]>
Subject: Re: psycopg3 transactions
Date: Sun, 17 Oct 2021 00:29:45 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CA+mi_8bXjHTrzDLQ+n_6K2MHVsr0J32X1HA28Ey9O+-Zm6JaeQ@mail.gmail.com>
	<[email protected]>
	<CA+mi_8afF2jMifiLSvL99+Ztupy1me7xDNAv0g47WxHWbwN9vw@mail.gmail.com>
	<CAH1rg6ZoQm=STwMR6AQ_FggxRxUn7qH_tLkRTfJTVYYdbTeL6w@mail.gmail.com>
	<trinity-cf9ddf31-623c-4512-beff-cf6d6d0116b8-1634205902640@3c-app-gmx-bs43>
	<CAH1rg6av5MR+yhEpwaxZNH+QrW+9ya9BQTx+w_Q9crm3e65yZQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>

Am Thu, Oct 14, 2021 at 03:38:21PM -0700 schrieb Adrian Klaver:

> >I would certainly suggest that a context manager calls
> >.rollback() during teardown rather than .commit() -- the
> >context manager cannot know whether actions really are to
> >be committed, even if technically possible.
>
> If I'm following that option exists:
>
> https://www.psycopg.org/psycopg3/docs/api/connections.html#psycopg.Connection.transaction
>
> force_rollback (bool) – Roll back the transaction at the end of the block even if there
> were no error (e.g. to try a no-op process).

Yes, but I would argue that force_rollback=True should be the
default.

Best,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B





view thread (28+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: psycopg3 transactions
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox