#26291: loaddata cannot deserialize fixtures with forward references and natural
foreign keys
-------------------------------------+-------------------------------------
     Reporter:  inglesp              |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Core                 |                  Version:  1.9
  (Serialization)                    |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by inglesp):

 Thanks for taking a look at this.

 There are a handful of problems with Django's current dependency
 resolution.

 Firstly, `loaddata` cannot handle circular references at all.

 Secondly, even without circular references, `dumpdata` can produce data
 that `loaddata` cannot load, requiring manual re-ordering of a fixture.
 This could happen if a field of a model instance references another
 instance of the same model, where the pk of the referenced model is
 greater than the pk of the referring model, since `dumpdata` dumps
 instances of a model in order of it pk.

 Finally, Django's current dependency resolution depends on `loaddata`
 importing data that was created by `dumpdata`.  If the data comes from
 another source, `sort_dependencies`'s logic must be followed.

 This last problem is the cause of my own interest in the issue, but I
 think that the fact that `dumpdata` can produce data that `loaddata`
 cannot load is reason enough to consider a solution.

--
Ticket URL: <https://code.djangoproject.com/ticket/26291#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.7d01e8433b67e3343ebdfaf9ceac8c99%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to