#24794: RunPython parameter "atomic" is ineffective.
-----------------------------+-------------------------------------
Reporter: vernondcole | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords: RunPython atomic commit
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------
This report is similar to #24630, but differs from it in detail. The fix
for #24630 is insufficient for this scenario.
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:
[https://docs.djangoproject.com/en/1.8/topics/db/transactions/]
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/24794>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.c7e1770a34dfca9604bf492b009c88e1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.