1

I'm trying to load data from a json file to my database. It works fine in sqlite... but in Postgresql I get the error: IntegrityError: Could not load jobs.JobStep(pk=None): null value in column "id" violates not-null constraint And I'm getting this error for all the tables that I don't provide the pk

The pk is null, but in this case Django shouldn't generate the pk? Here's the json simplified: http://pastebin.com/xzYizcES

The model(s): http://pastebin.com/pn8YFz0u

As you can see the model inherits from another model... I thought that could be the problem, but if I only change the pk value of JobStep from null to a valid number... it works.

Anyone has any idea?

dfranca
  • 5,156
  • 2
  • 32
  • 60
  • As described in [this question][1], you can't omit pk in json fixtures. However, it seems you can when using yaml. [1]: http://stackoverflow.com/questions/9436954/excluding-primary-key-in-django-dumpdata-with-natural-keys – Agate Jan 29 '14 at 18:31
  • But in this question it says that you can replace the value with null : "OR just replace the primary key value with null" But for me it didn't work, very weird. – dfranca Jan 29 '14 at 23:32

0 Answers0