On Mon, Jun 27, 2011 at 6:08 PM, Jacob Kaplan-Moss <ja...@jacobian.org> wrote: > On Mon, Jun 27, 2011 at 4:24 PM, Jim D. <jim.dal...@gmail.com> wrote: >> I spent some time last week and over the weekend nailing down a >> solution for https://code.djangoproject.com/ticket/3615 . This is the >> ticket about allowing forward references when loading data on the >> MySQL InnoDB backend. My patch implements the proposed change >> (disabling foreign key checks when the data is loaded) as well as a >> straightforward SQL SELECT check for integrity after the data is >> loaded, which if I understand it is the missing piece that has >> prevented this ticket from moving forward for the last 4 years... > > Interesting approach -- I wouldn't have thought of this! It feels a > bit nasty to me, but it's rather close to how deferred constraints > work behind the scenes anyway. I'd like to see some feedback from > other people who're experienced with MySQL; I don't know enough about > any potential downsides to spot 'em. But I think you've found a way to > cut the knot of this problem, and barring a better solution I'd like > to check this one in.
Disabling foreign key checks is exactly what mysqldump puts at the start of the dump. Presumably your database will have no bad references to start with, so the resulting dump shouldn't have any either, and thus be safe to load with foreign key checks off. http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html (for reference) -- Question the answers -- 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.