3

I have a Django 1.7 app, developed against sqlite3, and moving to Postgresql. One model table called Place has a parent relation to itself. I used dumpdata to create a .json extract.

When I attempt to use loaddata to read the extract into the Postgres db, Django (not postgres) gives me:

django.core.serializers.base.DeserializationError: Problem installing fixture '/home/ugliest/project/thub/dbdump25jan_nat.json': Place matching query does not exist;

This tells me that django is validating the data before loading it into the database. Is there a way to allow this data in before validation? I know that Postgres has the ability to defer constraint checking, but even if I could trigger that from django, it wouldn't prevent django from validating. How to get the data in?

I feel like I'm missing something obvious. This seems like it would happen often, and have a known simple fix. Do I really have to write some custom mess to reorder the extract file?

Edit: FWIW, never found an answer, and wrote a custom mess to reorder things.

ugliest
  • 101
  • 6

0 Answers0