Hello dear community!
At some point in time, there was a need to move the application database to django from mysql to postgresql. The first two approaches to this problem were unsuccessful, but allowed to deal with data integrity, eradicate problems for
manage.py syncdb
and
manage.py migrate
.
At the first approach, we tried to transfer the base through the conversion of the sql-sheet into the postgresql dialect.
On the second
./manage.py dumpdata
, we tried to transfer via
./manage.py dumpdata
, but we constantly got errors with keys and invalid data (there were many manual edits in the database).
A lot of time passed between the second and the third approach, and the last googling on the issue led me to
this article . Morally, I was already ready to analyze and parse line by line spoilers sql / yml, weighing under a gigabyte, there were blanks for this process ... and yet I decided to try and learn about the simplicity of the process.
')
Well, it went away (everything was done in virtualenv, an empty database was created in postgresql):
$ 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
Next 5 minutes of waiting (everything was done in a virtual, with a not very advanced configuration). A couple of times they crashed, with an error
: "created" NOT NULL
, in my case it could be solved by deleting the entry in the muscle table.
After checking with the new database configuration:
manage.py run_gunicorn
- everything starts without errors. Now it's time to optimize.
I hope this description will help confronted with a similar problem.