Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#4697 closed (wontfix)

loaddata ---- Problem installing fixture

Reported by: yml Owned by: nobody
Component: Core (Management commands) Version: 0.96
Severity: Keywords: loadtata
Cc: yml.nospam@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The command line loaddata is raising an error. I have tried to dump only the dj_survey application but I am getting a similar message. I have also tested the same scenario using json format. for your infomation the file initial_data was built using the dumpdata command.

Here it is the error message:
C:\yml\_myScript_\dj_things\web_development\workspace\dj_project> loaddata initial_data.json
Loading 'initial_data' fixtures...
Installing json fixture 'initial_data' from absolute path.
Problem installing fixture 'initial_data.json': (1452, 'Cannot add or update a child row: a foreign key constraint fails

(dj_project/dj_survey_interview, CONSTRAINT interviewee_id_refs_id_622e9931 FOREIGN KEY (interviewee_id) REFERENC

ES dj_survey_interviewee (id))')

Thank you

Attachments (2)

initial_data.xml (30.5 KB) - added by anonymous 12 years ago.
This is the result of dumpdata (2.4 KB) - added by anonymous 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by anonymous

Attachment: initial_data.xml added

This is the result of dumpdata

Changed 12 years ago by anonymous

Attachment: added

comment:1 Changed 11 years ago by jack139@…

Version: SVN0.96

I got the same problem. A way to resolve this error is a little bit rude.
STEP A, I use MySQL, so connect MySQL by command-line client
STEP B, Drop foreign key, such as

ALTER TABLE beta_digest DROP FOREIGN KEY next_id_refs_id_752367b9;

STEP C, run " loaddate"
STEP D, create foreign key constrant again, such as

ALTER TABLE beta_digest ADD CONSTRAINT next_id_refs_id_752367b9 FOREIGN KEY (next_id) REFERENCES beta_digest (id);

The command used in STEP B and STEP D can be found by " sqlreset"

BTW, I use xml format as data format.

comment:2 Changed 11 years ago by James Bennett

Resolution: wontfix
Status: newclosed

I'm pretty sure this is due to an issue that's explicitly covered in the loaddata documentation: MySQL has known, severe issues with forward references in fixtures that we really can't work around.

comment:3 Changed 10 years ago by christian_oudard

Ticket #3615 refers to this same issue.

Note: See TracTickets for help on using tickets.
Back to Top