#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
, CONSTRAINTinterviewee_id_refs_id_622e9931
FOREIGN KEY (interviewee_id
) REFERENC
ES dj_survey_interviewee
(id
))')
Thank you
Attachments (2)
Change History (5)
by , 18 years ago
Attachment: | initial_data.xml added |
---|
comment:1 by , 17 years ago
Version: | SVN → 0.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 KEYnext_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
) REFERENCESbeta_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 , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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.
This is the result of manage.py dumpdata