RunPython parameter "atomic" is ineffective.
|RunPython atomic commit
|Patch needs improvement:
I am attempting to apply a data migration to a Postgres table with millions of records -- my first attempt (using RunSQL) failed and rolled back after about two days of run time. It appears that the job must be done in smaller chunks, so I rewrote the migration using RunPython, limiting the size of the result set with a slicing, with set_autocommit(False) and explicit commit calls.
It appears from the documentation that the built-in transaction control can be overridden:
This should be safe, but may cause a crash if you attempt to use the schema_editor provided on these backends; in this case, please set atomic=False.
But "atomic=False" has no effect on the operation of the migration. Stepping through the code using a debugger, I failed to find anyplace where that parameter is actually used, nor could I find a way to short-cut the atomic transaction. It appears that I will need to write a stand-alone program to migrate the data.
Unless someone more talented than me can find a way to make "atomic=False" actually work, it should be removed from the code and from all documentation; or the documentation made more explicit to explain when and where it does work.