Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8507 closed (duplicate)

dumpdata/loaddata can't handle two of the same contenttypes having different IDs in different databases

Reported by: Erik Allik <eallik@…> Owned by: nobody
Component: Core (Serialization) Version: master
Severity: Keywords: dumpdata loaddata
Cc: eallik@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently loaddata and dumpdata are pretty dumb in that they are not able to identify when two objects/rows that have different database ID's are actually one and the same object (or equivalent).

For example, when dumping a dataset that has fkeys to the django_content_type table and then loading that data to another database which happens to have exactly the same content types installed but some of which have different database ID values, the outcome is an IntegrityError (or corrupted data). I think users should actually be able to do that without having to concern themselves with low level details such as database IDs.

As a potential solution, it could be possible define how two model objects compare two be able to match equivalent objects with different ID's.

As a side note, this could actually evolve to something that would also allow for callbacks to determine whether to overwrite a database object with an fixture object or not (for example, based on modification dates). This would simplify synchronizing databases and would not be difficult to implement either.

Change History (2)

comment:1 Changed 10 years ago by Russell Keith-Magee

Resolution: duplicate
Status: newclosed

Duplicate of #7052

comment:2 Changed 10 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

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