Opened 17 years ago

Closed 16 years ago

Last modified 15 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

Description

Hello,
The command line manage.py 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>manage.py 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 17 years ago.
This is the result of manage.py dumpdata
models.py (2.4 KB ) - added by anonymous 17 years ago.
models.py

Download all attachments as: .zip

Change History (5)

by anonymous, 17 years ago

Attachment: initial_data.xml added

This is the result of manage.py dumpdata

by anonymous, 17 years ago

Attachment: models.py added

models.py

comment:1 by jack139@…, 16 years ago

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 "manage.py 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 "manage.py sqlreset"

BTW, I use xml format as data format.

comment:2 by James Bennett, 16 years ago

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 by christian_oudard, 15 years ago

Ticket #3615 refers to this same issue.

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