felipeecst
felipeecst

Reputation: 1415

Postgres to Mysql - Transfer data from one database to another every day

I have a regular Rails application that uses a Postgres database, but I have the following requirement: every day I have to transfer data from all tables of this Postgres database to the customer's MySQL database.

There's no API available, so I have to connect to the customer's database and perform create/update queries for the new/updated rows. They will allow my IP for these operations.

What would be the best way to achieve that? I thought of some options:

1) Schedule a job on my Rails application to perform that operation (the con here is: this logic is specific for one customer, so I don't like the idea of having this on the main codebase)

2) Deploy a lightweight application (maybe node/express) that reads from one database and sends to another (the con here is: I'll have to maintain another server to keep this running)

Are there any other options that I am not considering?

Upvotes: 0

Views: 111

Answers (1)

Gregory Arenius
Gregory Arenius

Reputation: 3204

You could use a foreign data wrapper to connect to the MySQL database from your PostgreSQL database. That would allow you to read and write to the customer database with very little that you would need to write or maintain.

It looks like there is a well maintained wrapper for MySQL.

Upvotes: 1

Related Questions