10

I am trying to convert from a sqlite3 db to Postgres (so that I can have timezone-aware datetime fields with django 1.4). I dumped the data from the sqlite3 db. Then switched settings to point to the empty postgres db. Then ran syncdb, then south migrations. All good so far.

When I try to reload the dumped data into postgres, I get an error:

An exception occurred while loading data: duplicate key value violates unique constraint "django_content_type_app_label_model_key" DETAIL: Key (app_label, model)=(django_twilio, caller) already exists.

I removed twilio from the app and still got a similar error, just with the next object in the db.

Any help is appreciated. I'm new to programming and django. Thanks!

2
  • Is this a SQL data dump or a Django data dump? Commented Apr 9, 2012 at 20:40
  • It is Django. I actually found the answer in an existing stackexchange post: stackoverflow.com/questions/3076928/…. I needed to TRUNCATE the database. Thank you for your help. Commented Apr 9, 2012 at 21:17

1 Answer 1

6

It is Django. I actually found the answer in an existing stackexchange post:

Switching Django project from sqlite3 backend to postgresql failes when loading datadump

I needed to TRUNCATE the database. Thank you for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.