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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to