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 maggyero
Recipients erlendaasland, ghaering, james.oldfield, lemburg, maggyero, r.david.murray, zzzeek
Date 2021-01-05.18:04:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609869898.76.0.596674766427.issue39457@roundup.psfhosted.org>
In-reply-to
Content
@james.oldfield

> What that answer doesn't mention is that, even with even with isolation_mode=None, it's perfectly possible to start a transaction, which takes the SQLite engine out of autocommit mode.

Exactly, so since autocommit=True is equivalent to isolation_mode=None I do not see why you the name ‘autocommit’ would be a problem. As you said, when you issue BEGIN, you leave autocommit mode.

> Under your proposal, the first line would be changed to say "autocommit=True", even though not all the code below is in autocommit mode (according to the SQLite engine's definition).

What is the difference with isolation_mode=None which also means autocommit mode?

> What's more, I could insert this line of code between statements 3 and 6:
>    print("Autocommit mode?", conn.autocommit)
> And it would print True even though autocommit mode is off!

No, because the autocommit property would be automatically updated to False at conn.execute("BEGIN"), which is the standard behaviour as @lemburg explained.

@lemburg

> I guess the SQLite driver does not start a new transaction for SELECTs, since these are usually read-only

Nor for DDL statements (CREATE, DROP).

> 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).

Since DQL statements (SELECT) are read-only, maybe we could keep the optimization and start transactions implicitly only for DDL statements (CREATE, DROP)?
History
Date User Action Args
2021-01-05 18:04:58maggyerosetrecipients: + maggyero, lemburg, ghaering, r.david.murray, zzzeek, erlendaasland, james.oldfield
2021-01-05 18:04:58maggyerosetmessageid: <1609869898.76.0.596674766427.issue39457@roundup.psfhosted.org>
2021-01-05 18:04:58maggyerolinkissue39457 messages
2021-01-05 18:04:58maggyerocreate