Forums

Migrating from MySQL to PostgreSQL (web2py)

I am looking to migrate from MySQL to PostgreSQL for my web2py app. While I have a general idea of what to do, I'm not sure if there are any particular things about the PythonAnywhere and web2py environment that I should be taking into account. I have quite a bit of data, so I want to know as much as I can before I can ahead and move forward.

I wanted to use pgloader to make the migration as easy as possible: http://pgloader.io/download.html

However, I'm not quite sure how I would install pgloader on Pythonanywhere.

Has anyone else had experience with this (pgloader, or migrating from MySQL to PostgreSQL on PythonAnywhere), that could shed some light on the process?

Hm. I've never used pgloader, but it looks like it might be tricky to install it into pythonanywhere.

Instead, does web2py support some sort of serialisation, like dumping a database contents to json? then you could re-import it...

Thanks Harry! I am going to go with your suggestion and import/export the database to/from a csv file (link for others who are interested): https://groups.google.com/forum/#!topic/web2py/mQk2hoRf7gw

After exporting the database to a csv file, I will change the database connection string to the PostgreSQL database, run web2py which will build the tables in the new database, and then import the data from the csv file.

This won't preserve the ID's, but I can manually change the very few places I have use a hard-coded ID reference. This worked fine so far on my local site, but the live site has a lot more data and activity, so hopefully this will go over well.

Sounds like a sensible plan. Good luck :-)