I have need to migrate some sqlite3 databases to mysql for a couple django-cms projects at work. Typically in the past
I’ve used fixtures in Django to get this done, but I usually have to align the planets and concoct the elixir of
life to get the fixtures to migrate properly. It usually has to do with foreign key errors something. This is something
that should just be easy, but in my experience with Django, it never is.
Theres’s a couple posts on stackoverflow with various scripts to convert content from sqlite to mysql, but none of
them lined up the planets just right.
Then I happened on this page where there’s a python script by this guy that is not based on the others. And it just worked.
The script looks like:
1 | #! /usr/bin/env python |
Usage
1 | $ sqlite3 mydb.sqlite .dump | python convert.py > out.sql |
Thank you Behrang Noroozinia from internet land, you solved a long-standing problem of mine.