Opened 7 years ago

Closed 7 years ago

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

Description

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 7 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #7052

comment:2 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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