The Django docs for TransactionMiddleware state: "When a request starts, Django starts a transaction. If the response is produced without problems, Django commits any pending transactions."
This is apparently not actually true. I have some code using cursor.execute while doing no operations using the ORM through a full request cycle-- but it does run under TransactionMiddleware. It turns out that if transaction.set_dirty never gets called, then the request completes without a commit going to the DB; the DB rightfully interprets this as a rollback. This caused silent data loss for about a year for me; it wasn't obvious for some time because my .execute call often coincides with other ORM use, meaning that a large portion of the data I meant to save actually did get saved. I would like basically any data going to the DB to trigger set_dirty. I *think* this just means cursor.execute with insert/update/delete, but I haven't reviewed closely yet. Is there any objection to this change? I can work up a patch, but this is obviously a touchy area. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---