Help converting from mysql to postgres

61 views
Skip to first unread message

frocco

unread,
May 18, 2013, 1:23:04 PM5/18/13
to django...@googlegroups.com
Hello

Here are my steps.

python manage.py dumpdata --database=legacy > data.json

python manage.py loaddata  data.json --database=default

IntegrityError: Problem installing fixture 'data.json': Could not load accounts.UserProfile(pk=17): duplicate key value violates unique constraint "accounts_userprofile_user_id_key"
DETAIL:  Key (user_id)=(17) already exists.

In the mysql table, there is only one record with user_id 17

frocco

unread,
May 18, 2013, 6:47:06 PM5/18/13
to django...@googlegroups.com
I am getting 

IntegrityError: duplicate key value violates unique constraint "catalog_pricing_pkey" 
DETAIL: Key (id)=(8) already exists. 

catalog_pricing_id_seq
Start Value 8
Last Value 1
Increment 1


There are 8 records in table. id 1 through 8

If I reset sequence, last value is set to 1
if I restart sequence, last value is set to 8

Mike Dewhirst

unread,
May 19, 2013, 2:41:09 AM5/19/13
to django...@googlegroups.com
I cannot claim any DBA credentials so be careful reading further.

I use dumpdata successfully with lots of --exclude=djkgd.sdsghg options
only for testing fixtures. I have tried a few times and failed to get it
working transferring between two Postgres databases.

I use postgres dump and load for that purpose. It is reliable and easy.
I can show you my scripts for that if you want.

Maybe you can use MySQL dump and edit the output to look like the
Postgres dump then load that?

Maybe someone has written converter?

Mike
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

frocco

unread,
May 19, 2013, 9:47:49 AM5/19/13
to django...@googlegroups.com
Thanks,

I finished this, by using dump data on one app at a time.
I was trying to do the whole project at once.

I did run into sequence errors.
I followed this.


On Saturday, May 18, 2013 1:23:04 PM UTC-4, frocco wrote:
Reply all
Reply to author
Forward
0 new messages