[DB-SIG] Adding Connection.autocommit as standard extension to DB-API 2.0 (PEP 249)

Marc-Andre Lemburg mal at egenix.com
Fri Oct 28 10:06:52 EDT 2022


On 28.10.2022 16:02, Mike Bayer wrote:
> 
> 
> On Fri, Oct 28, 2022, at 9:58 AM, Marc-Andre Lemburg wrote:
>> If there is a pending transaction, though, there are three approaches
>> we could take:
>>
>> 1. The database module raises an exception, to force an explicit
>>     .commit() or .rollback() by the programmer.
>>
>> 2. The module automatically commits the pending transaction,
>>     since that's what autocommit is all about.
>>
>> 3. We leave these semantics open and up to the database module
>>     to determine.
>>
>> My preference would be option 2, since this makes things clear for
>> everyone and is intuitive (well, at least for me :-)).
> 
> option 3 is likely what will occur in practice.   it feels a little 
> awkward for an attribute set operation to move forward with a 
> transactional modification to the database server.

Think of this as a property, which is how many database modules
will implement it.

I agree that it feels a bit awkward, especially since setting
an attribute should normally not cause exceptions, but it's become
a standard among modules nonetheless (I don't remember who started
with it).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Oct 28 2022)
 >>> Python Projects, Coaching and Support ...    https://www.egenix.com/
 >>> Python Product Development ...        https://consulting.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611
                https://www.egenix.com/company/contact/
                      https://www.malemburg.com/



More information about the DB-SIG mailing list