Hi I got a MySQL database dump, it's a sql
file. Is there a way to import it to Postgres database using ruby? I know that there is a command like ActiveRecord::Base.connection.execute(IO.read("path/to/file"))
but it fails, because of different databases. The main problem is to convert somehow sql file, to be a Postres format. Is it even possible using only Ruby On Rails?
Asked
Active
Viewed 393 times
0

Dawid
- 644
- 1
- 14
- 30
-
Are you tried to use [--compatible=name](http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html#option_mysqldump_compatible) command line argument? – Maxim Feb 28 '15 at 20:12
-
The problem is that I didn't even create this dump. I just got a sql file which I need to import to postgres database. I don't have acces to MySQL database. – Dawid Feb 28 '15 at 20:16
2 Answers
0
Have you checked out pgloader? http://pgloader.io/ It's really easy to use and has helped me lots.
Or I'll refer to this question; How to import existing *.sql files in PostgreSQL 8.4?

Community
- 1
- 1

Kevin Ferm
- 113
- 3
- 10
0
Try to use mysql2postgres. I have used it more than 5 years ago but seems like it supported yet.

Maxim
- 9,701
- 5
- 60
- 108