[DB-SIG] autocommit support in pep-249

M.-A. Lemburg mal at egenix.com
Wed Sep 14 13:00:01 CEST 2011


Michael Bayer wrote:
> 
> On Sep 13, 2011, at 2:39 PM, Joshua D. Drake wrote:
> 
>>
>> Oh now that is interesting. Hmmm... perhaps conn.autocommit() is actually a synonym for conn.begin() except that it sets the autocommit property? So we would have two semantics:
>>
>> conn.begin() -- Starts a transaction, will not commit unless explicit conn.commit() is called.
>>
>> conn.autocommit() -- Works in autocommit mode, calling conn.commit() is redundant, each statement is executed as it is delivered to the database.
> 
> I'm -1 on conn.begin().   I've spent years explaining to users the beauty of the DBAPI in that it has no "begin" method.   Providing for two different modes of doing the same thing, i.e. working with a standard DBAPI connection in a transaction, or forcing autocommit to True then using begin(), creates for a more confusing and controversial interface.   

-1 on connection.begin() as well.

DB-API modules are free to implement this, but it should not be
part of the DB-API standard, since it causes rather complicated
transactional/non-transactional states on the connection.

The simple implicit transaction start when opening a connection
or doing a commit/rollback is much less error prone and protects
the user from data corruption in error situations.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 14 2011)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2011-10-04: PyCon DE 2011, Leipzig, Germany                20 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   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
               http://www.egenix.com/company/contact/


More information about the DB-SIG mailing list