跨多个异构数据库执行连接,例如PostgreSQL 和 MySQL [英] Performing a join across multiple heterogenous databases e.g. PostgreSQL and MySQL

查看:75
本文介绍了跨多个异构数据库执行连接,例如PostgreSQL 和 MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,一种分布式数据库的东西.

There's a project I'm working on, kind of a distributed Database thing.

我从创建概念模式开始,并对表进行了分区,以便我可能需要在 MySQL 和 PostgreSQL 中的表之间执行连接.

I started by creating the conceptual schema, and I've partitioned the tables such that I may require to perform joins between tables in MySQL and PostgreSQL.

我知道我可以编写某种中间件来分解 SQL 查询并发出针对单个数据库的子查询,然后它们合并结果,但如果可能的话,我想使用 SQL 来做到这一点.

I know I can write some sort of middleware that will break down the SQL queries and issue sub-queries targeting individual DBs, and them merge the results, but I'd like to do do this using SQL if possible.

到目前为止,我的搜索结果是这个(用于 MySQL 的联合存储引擎)但它似乎适用于 MySQL 数据库.

My search so far has yielded this (Federated storage engine for MySQL) but it seems to work for MySQL databases.

如果可能的话,我希望能提供一些关于该看什么的指针,最好是在 Python 中.

If it's possible, I'd appreciate some pointer's on what to look at, preferably in Python.

谢谢.

推荐答案

从 postgres 方面,您可以尝试使用 外部数据包装器mysql_ftw (示例).然后可以通过各种 Postgres 客户端运行带有连接的查询,例如 psql、pgAdmin、psycopg2(对于 Python)、等

From the postgres side, you can try using a foreign data wrapper such as mysql_ftw (example). Queries with joins can then be run through various Postgres clients, such as psql, pgAdmin, psycopg2 (for Python), etc.

这篇关于跨多个异构数据库执行连接,例如PostgreSQL 和 MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆