I'm working on a project that is doing this and wrote a data migration
script.  The gist of it is that it connects to the old MySQL database
using straight MySQLdb, and connects to the new Postgresql database
using Django and the ORM.  I iterate over all tables and such and call
my ORM methods to create the new records and save them.

Here's a snippet:

import MySQLdb
from myproj.myapp.models import Lookup

# connect to old table
db = MySQLdb.connect(host=OLD_DB_HOST, user=OLD_DB_USER,
passwd=OLD_DB_PASS, db=OLD_DB_NAME)
c = db.cursor(MySQLdb.cursors.SSDictCursor)

# Import a lookup table
sql = 'SELECT * FROM lookup_table'
c.execute(sql)
while True:
    row = c.fetchone()
    if not row:
        break
    Lookup(name=row['name']).save()

-Rob

On Jan 3, 2:10 am, Szymon <szy...@mwg.pl> wrote:
> Hello,
>
> I've found in archives message:
>
> > Check out django_extensions 
> > app,http://code.google.com/p/django-command-extensions/.
> > It has a command, dumpscript [...]
>
> It takes ages to complete. I've tried that method yesterday. I've
> turned off my web server and ran that command. After 6 hours it wasn't
> completed. (~1 GB database)
>
> So there is any other working solutions for migrating MySQL ->
> Postgre?
>
> Regards,
> Szymon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to