Code

Opened 7 years ago

Closed 7 years ago

Last modified 6 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: UI/UX:

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

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by anonymous

This is the result of manage.py dumpdata

Changed 7 years ago by anonymous

models.py

comment:1 Changed 7 years ago by jack139@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from SVN to 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 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 Changed 7 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from new to 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.

comment:3 Changed 6 years ago by christian_oudard

Ticket #3615 refers to this same issue.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.