[issue16958] The sqlite3 context manager does not work with isolation_level=None

Kodiologist report at bugs.python.org
Fri Mar 25 10:12:39 EDT 2022


Kodiologist <nonce0010lep at arfer.net> added the comment:

This bit me real bad. On Python 3.8, I wrote a program with `isolation_level = None` and `with db: …` and spent a long time figuring out why writes were so slow. Turns out that `with db` doesn't actually start a transaction in this case, as the documentation suggests it should. This issue is approaching the age of 10, so if there's still uncertainty about how the implementation or the interface should change, the docs should be clarified in the meantime.

I always thought the Python library turning off autocommit by default, contrary to SQLite's command-line interface, was needlessly surprising. I think it contributed to this problem because the docs about context managers seem to assume you have autocommit off.

----------
nosy: +Kodiologist

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue16958>
_______________________________________


More information about the Python-bugs-list mailing list