This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients erlendaasland, ghaering, james.oldfield, lemburg, maggyero, r.david.murray, zzzeek
Date 2021-01-05.17:25:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1a4f9c52-61ba-cd43-7bc5-3dfa0c8062fa@egenix.com>
In-reply-to <1609864859.65.0.886771185809.issue39457@roundup.psfhosted.org>
Content
I think there's a bit of a misunderstanding here. When relying on
a DB-API driver's transaction API, you are not allowed to issue
separate transaction commands to the DB backend via the .execute()
methods. You have to use conn.commit() and conn.rollback().

The DB-API wants drivers to have connections default to transactional
behavior and implicitly start transactions when opening the connection
as well as when ending one (via .commit() or .rollback()) - provided the
backend does support transactions.

It also suggests that a method may be used to set the transactional
behavior.

Now, historically, many drivers have not always used methods for
this, but instead (or in addition) provide a property
connection.autocommit to allow setting or querying the current
state. Over time, this has become more or less a standard.

Aside: This is a bit unfortunate, since users would not expect
exceptions from such properties (e.g. network errors), but this where
things have moved and it's hard to change.

I guess the SQLite driver does not start a new transaction for
SELECTs, since these are usually read-only, but don't know whether
this still holds today (e.g. think of UDFs running INSERTs or UPDATEs).

For the same reason, removing the SELECT "optimization" may cause
a backwards incompatible change, which can be tricky to identify
and cause corruption of data (in this case, data not written to
the database, where it previously was written).
History
Date User Action Args
2021-01-05 17:25:16lemburgsetrecipients: + lemburg, ghaering, r.david.murray, zzzeek, maggyero, erlendaasland, james.oldfield
2021-01-05 17:25:16lemburglinkissue39457 messages
2021-01-05 17:25:16lemburgcreate