public inbox for [email protected]
help / color / mirror / Atom feedFrom: Karsten Hilbert <[email protected]>
To: Daniele Varrazzo <[email protected]>
Cc: Paolo De Stefani <[email protected]>
Cc: Psycopg <[email protected]>
Subject: Aw: Re: psycopg3 transactions
Date: Thu, 21 Oct 2021 13:06:34 +0200
Message-ID: <trinity-b5bbbf6a-2f7d-4865-ad6b-3e846cf58399-1634814394835@3c-app-gmx-bap69> (raw)
In-Reply-To: <CA+mi_8bY1HJrAVrUFsdDCqJT4+UjK7i7Lfso4dN_0nNf7RU4nQ@mail.gmail.com>
References: <[email protected]>
<CA+mi_8bXjHTrzDLQ+n_6K2MHVsr0J32X1HA28Ey9O+-Zm6JaeQ@mail.gmail.com>
<[email protected]>
<CA+mi_8afF2jMifiLSvL99+Ztupy1me7xDNAv0g47WxHWbwN9vw@mail.gmail.com>
<[email protected]>
<CA+mi_8ZJy5yHovbjBhevWLhm9b3RH67qD+_5Mk+trfb1-Z19jQ@mail.gmail.com>
<CA+mi_8ZvfQ3ndZDrRFX1XCfMyGLhkp5ZVq4Y92iZe4nxtkw_Yw@mail.gmail.com>
<YWtWyC/[email protected]>
<CA+mi_8bY1HJrAVrUFsdDCqJT4+UjK7i7Lfso4dN_0nNf7RU4nQ@mail.gmail.com>
> The behaviour of a dbapi connection, without context block, is to just close the communication. The fact that this results in a rollback > stems only from the behaviour of the server
But that's the whole point? A driver should _not_ (by default) alter the default
behaviour of the other end, IMO, without extremely good reason. There _is_ good
reason for the transaction context manager, but not for the connection context
manager or plain use.
> I think that using 'execute("INSERT....")' is already quite a conscious decision of operating on the database.
I agree. But the decision is not "this IS to be in the database" (or else no need for
transactions) but rather "this is to be in the database IF other, perhaps not even
database related, things suceed".
> asking that the program to 'conn.commit()' explicitly seems an unrequested, kinda ritual, final blessing.
Exactly.
> Sending an explicit ROLLBACK is an occurrence much more rare,
Exactly, and thusly easily forgotten, with possibly dire consequences
(in the case of default-commit, as opposed to default-rollback).
Karsten
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]
Subject: Re: Aw: Re: psycopg3 transactions
In-Reply-To: <trinity-b5bbbf6a-2f7d-4865-ad6b-3e846cf58399-1634814394835@3c-app-gmx-bap69>
* 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