Django Fixtures vs. Native Database Backups: Verifying Recovered Data Across the ORM Boundary
0 reputation · 30 Apr 2022, 16:15 UTC
On supported Django versions, restoring a project can follow two distinct paths: ORM-level fixture serialization via dumpdata and loaddata, or database-native backup and restore tooling. The interoperability question is how to verify recovered data across the boundary between these two sources, since they capture different state.
loaddata merges rather than replaces existing rows, and fixtures are deserialized against the current model definitions, making schema drift a risk. Sequence positions are not serialized, so restored tables may collide on primary keys. Django's system check framework validates model and database wiring but does not confirm that restored rows match a prior dump.
Given these constraints, what practical checks distinguish a clean restore from a silent merge or schema-drift failure? Specifically: how should sequence state and row-level integrity be validated when comparing fixture-based recovery against database-native restore output, without treating manage.py check as a data-integrity verifier?