1

I have a database hosted on Amazon RDS. I am developing a Rails application with primary database as PostgreSQL. The Postgres database needs to be updated with data from RDS. I need to pull records from MySQL and then load it into Postgres.

Also, this is not database migrations.

One option is to create a secondary database (MySQL) in my rails application. But this does not seem a good option as I need to transfer data only when needed and not very frequently.

What is the best way to achieve this? Can this be done through pgloader?

UPDATE

This solved my issue. I just needed to read from MySQL and this is working fine. Are there any drawbacks for this approach?

4
  • Why not just export a CSV and then import it? If it isn't something done frequently, it might be best to go with a simple solution. It could also be easily automated if it needs to happen on a regular basis. Commented Apr 28, 2017 at 4:51
  • Can I export to CSV from within Rails while using Postgres as the primary database and without setting a secondary MySQL database? Commented Apr 28, 2017 at 5:12
  • Either connect to the mysql database from your rails application directly and pull whatever data you need or develop an api for the mysql database and use that. Commented Apr 28, 2017 at 5:17
  • How and where can I develop an api for mysql? Commented Apr 28, 2017 at 5:29

1 Answer 1

0

You can use PostgreSQL's Foreign Data Wrappers : your MySQL tables will be viewed as PostgreSQL tables. See : https://www.postgresql.org/docs/current/static/postgres-fdw.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.