[issue10740] sqlite3 module breaks transactions and potentially corrupts data
aaugustin
report at bugs.python.org
Thu Apr 17 22:43:46 CEST 2014
aaugustin added the comment:
That patch solves the problem, at the cost of introducing an unwieldy API, "operation_needs_transaction_callback".
I'm very skeptical of the other API, "in_transaction". Other database backends usually provide an "autocommit" attribute.
"autocommit" is the opposite of "in_transaction" for all practical purposes. There's only two situations where they may be equal:
- before the first query
- after an explicit commit
Then you aren't in a transaction and you aren't in autocommit. But in these cases, in practice, the question you want to ask is "is the next query going to create a transaction?" (and if not, I may want to create one.)
So the semantic of "connection.autocommit" is much more useful than the semantic of "connection.in_transaction".
While you're there, it would be cool to provide "connection.autocommit = True" as an API to enable autocommit, because "connection.isolation_level = None" isn't a good API at all -- it's very obscure and has nothing to do with isolation level whatsoever.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10740>
_______________________________________
More information about the Python-bugs-list
mailing list