Django request transactions don't completely rollback after save() called. TransactionMiddleware not behaving as expected?

I could believe that you haven't set up the transaction middleware correctly, but if the transaction. Commit_on_success decorator isn't working, it sounds to me like the table might be using MyISAM. You can check the engine with the following command in the mysql shell: show table status where name="test.

Yep - absolutely positive InnoDB is set up as the database engine. That's why I included the snippet showing the raw SQL. When I executed this code with a MyISAM engine, it committed two entries to the database; when I switched to InnoDB it only showed one entry, having rolled back the transaction.

However, trying to do the same with Django, it always commits the save operation, regardless of which database engine I use. I ran the SQL above anyway, and it clearly showed InnoDB as the engine for the "test" table – Andy K Nov 23 at 22:38 OK, I misread your raw SQL snippet the first time. I have one final idea.

Django will create a table for the test model named myapp_test, not test. Are you testing the same table with the SQL and Django? – Alasdair Nov 24 at 11:50 I did things the other way round: first I created the table in the database (specifying innodb as the engine) and then ran inspectdb to generate the Django model.In this case will Django still create another internal table somewhere that I need to track down (and check that it's using InnoDB)?

– Andy K Nov 24 at 12:49 Here's the docs about table names. You can specify the table name that Django will use with the db_table meta option. Inspectdb does appear to specify the db_table meta option correctly, so this might not be the problem.

– Alasdair Nov 24 at 13:05 I've just been through and set all the django tables to be innodb as well. And verified the db_table meta-data. But no good - the transaction still doesn't rollback after an exception – Andy K Nov 24 at 22:17.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions