5

In order to host my Python/Django app on Heroku, I'm trying to convert my db from MySQL to Postgres following the instructions on https://realpython.com/blog/python/migrating-your-django-project-to-heroku/. I'm currently running OSX 10.9, and am using the tool mysql2pgsql to make the transfer.

When I try to run the command "py-mysql2pgsql -v -f mysql2pgsql.yml" to actually transfer the db, it copies over the first three tables, and then hits a snag on auth_user, returning the error "raise Exception('unknown %s' % column['type']) Exception: unknown datetime(6)". This seems strange, because auth_user is generated by one of Django's default installed apps, so I wouldn't expect it to cause any errors.

Any idea what could be causing this error or what I should be doing differently? Thanks.

sundar nataraj
  • 8,524
  • 2
  • 34
  • 46
jtimmins
  • 367
  • 3
  • 13

1 Answers1

4

in the directory 'Lib\site-packages\py_mysql2pgsql-0.1.6-py2.7.egg\mysql2pgsql\lib' edit the like 76 postgres_writer.py file as

from

 elif column['type'] == 'datetime':

to

elif column['type'] == 'datetime' or column['type'].startswith('datetime('):

I was facing the same problem, this solution worked for me.

Javed
  • 5,904
  • 4
  • 46
  • 71