>My conclusion is that the only sane thing to do is:
>1. Only ever create connections in autocommit mode.
>2. Only ever use `with connection.transaction()` to control transactions.
>3. Forget that `connection.commit()` and `connection.rollback()` exist, and never use them.
What if you need to rollback a hitherto valid transaction ?
Transactions are there for a reason. It seems best to explicitely use them ?
I'm not sure I fully understand your question/statement but let me try to respond.
We are still "using transactions", just with more precise, more explicit*, and more flexible* semantics, represented by a context manager.
Rolling back a transaction is possible by raising a Rollback exception within a block.
I hope this answers your question but if not please describe the scenario you are thinking about.
Dani
(*More explicit because in the conventional autocommit=false approach, the beginning of the transaction is an implicit side-effect of executing another statement, which may or may not actually begin a transaction depending on whether one is in progress. More flexible because you can have nested transaction blocks which operate in an independent and composable way.)