简体   繁体   English

Postgres到Mysql-每天将数据从一个数据库传输到另一个数据库

[英]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. 我有一个使用Postgres数据库的常规Rails应用程序,但我有以下要求:每天我必须将数据从该Postgres数据库的所有表传输到客户的MySQL数据库。

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. 没有可用的API,因此我必须连接到客户的数据库并对新的/更新的行执行创建/更新查询。 They will allow my IP for these operations. 他们将允许我的IP进行这些操作。

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) 1)在我的Rails应用程序上安排一个作业来执行该操作(这里的缺点是:此逻辑是特定于一个客户的,所以我不喜欢在主代码库上使用该逻辑)

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) 2)部署一个轻量级应用程序(可能是节点/表达式),该应用程序从一个数据库读取并发送到另一个数据库(这里的缺点是:我将不得不维护另一台服务器以使其保持运行状态)

Are there any other options that I am not considering? 我没有其他选择吗?

You could use a foreign data wrapper to connect to the MySQL database from your PostgreSQL database. 您可以使用外部数据包装器从PostgreSQL数据库连接到MySQL数据库。 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. 看起来有一个维护良好的MySQL包装器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mysql-如何在每周的特定日期和时间将数据从一个表转移到另一个表? - Mysql - How can I transfer data from one table to another on a specific day and time in the week, every week? 将数据从一个数据库传输到另一个 MYSQL - Transfer data from one database to another MYSQL 无法将mysql数据从一个数据库传输到另一个数据库 - Can't transfer mysql data from one database to another 每5秒将数据从一个表复制到另一个@mysql数据库 - copy data from one table to another @mysql database every 5 secs 如何自动将数据从一个MySQL数据库传输到另一个MySQL数据库? - How to transfer data automatically from one MySQL Database to another MySQL Database? 如何将数据从一个mysql数据库传输到另一个数据库,以及如何使用python映射具有不同列名的数据 - how to transfer data from one mysql database to another and mapping the data with different column names using python SQL查询:数据从一个数据库传输到另一个数据库 - SQL query : Data transfer from one database to another database Select 每天特定时间的一条数据 MySQL - Select one piece of data from every day at a specific hour MySQL Python脚本将数据从一台MySQL服务器传输到另一台MySQL服务器 - Python script to transfer data from one MySQL server to another one MYSQL将数据从一个表转移到另一个表的过程 - MYSQL Procedure to transfer data from one table to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM