Thinking again, a few more points come to mind: On Friday 01 March 2013, Aymeric Augustin wrote: > > Such transactions are useless and don't come for free. Relying on them to > enforce integrity is extremely fragile — what if an external library > starts writing to a log table in the middle of one of these implicit > transactions?
Then it's the external library that is at fault; it should be using a separate alias, with its own transactions. > The term "footgun" comes to mind. > True; but has a wider implication than you seem to give it credit for. In particular, > > ** Backwards-compatibility ** > > Roughly, I'd classify Django users in four groups: > 1 - "Transactions, how do they work?" > 2 - "Django autocommits, doesn't it?" > 3 - "I'm using TransactionMiddleware!" > 4 - "I'm managing my transactions." > > Groups 1 and 2 won't see the difference. This will turn existing projects from correct (though perhaps fragile) to buggy, exactly in groups 1&2, where the users are less likely to understand the issues. The apps are correct today -- they rely on the documented transaction behavior, even if the authors are not fully aware of it. And they will turn buggy in a way that is not likely to be detected by tests, because it will have effects mostly under concurrent access or system crashes -- circumstances you don't usually have in tests. Thus, > > I don't see much point in providing an option to turn autocommit off, > because starting a transaction is a much more explicit way to achieve the > same effect. We usually don't provide "backwards compatibility with bugs". > -1. Make it easier (and cross-backend) to set db-level-autocommit on. Put the setting for it in the default template for new projects. Don't change existing code from "fragile" to "subtly broken". Shai. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.