Migration from mysql to postgresql

Hello dear community!

At some point in time faced with the need to transfer the database in django app from mysql to postgresql. The first two rounds to this problem were unsuccessful, but allowed to deal with the data integrity, to eliminate problems for manage.py syncdb and manage.py migrate.

The first time we tried to move the base through the conversion of sql-sheets in the dialect of postgresql.
On the second pass we tried to migrate using ./manage.py dumpdata, but always got error with the keys, invalid data (our database had a lot of manual changes).

Between the second and third time it took a lot of time, and the last gugleniya on the issue led me to this article. Mentally I was already prepared to analyze and parse line by line footcloths sql/yml weighing under GB, were blanks for this process... and I decided to try and go for the simplicity of the process.

And that Poehl (all were performed in a virtualenv, postgresql was created empty database):
the
$ pip install py-mysql2pgsql
$ py-mysql2pgsql
No configuration file found.
A new file has been initialized at: mysql2pgsql.yml
Please review the configuration and retry...

$ vim mysql2pgsql.yml

$ py-mysql2pgsql -v-f mysql2pgsql.yml



Then about 5 minutes of waiting (all done in virtual reality, with a not very advanced configuration). A couple of times out with the error ERROR: null value in column "created" violates NOT NULL constraint, in my case it was solved by deleting a record in the muscle table.

After a check with the new configuration database: manage.py run_gunicorn — everything runs without errors. Now it is time optimization.

I hope this description will help encountered similar problem.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Automatically create Liquibase migrations for PostgreSQL

Vkontakte sync with address book for iPhone. How it was done

What part of the archived web