虚拟联合 SQL 数据库

huangapple go评论79阅读模式
英文:

Virtual federated sql database

问题

我需要实现以下内容,并希望能够得到一些解决该问题的最佳思路:

我有几个SQL数据库,并希望提供使用某种联合数据库的选项,即一个虚拟的SQL层将接收(只读)查询。这些查询应当针对每个单独的数据库执行,并合并为总结果发送回查询的发起者。

因此,虚拟SQL层的任务是接收初始查询,调用单个数据库,并合并结果。另外出于隐私原因,虚拟SQL层需要实现删除特定结果的规则。因此,我需要能够在虚拟层中编写自己的代码。

技术方面我比较开放,但是我更倾向于Java。目前,我正在考虑以H2项目为基础,并在其中进行修改。

英文:

I need to implement the following and was hoping to get some ideas on how to solve the problem best:

I have several SQL databases and want to offer the option to use a somehow federated database, i.e. a virtual SQL layer is supposed to receive (read-only) queries. These queries should be executed for each of the single databases and merged to a total result and send back to the sender of the query.

So, the virtual SQL layers task would be to receive the initial query, call the single databases, and merge the result. Additionally for privacy reasons the virtual SQL layer needs to implement rules for removing specific results. Thus I need to be able to write my own code in the virtual layer.

Technology-wise I am open, however, Java would be preferred.
So far, I am considering taking the H2 project as a base and make modifications there.

答案1

得分: 1

要使用 H2 构造实现这一点,您将需要实现一个 TableEngine。有关此的详细信息,请参阅功能文档。不应该需要对 H2 的实际源代码进行修改。

已经有一个可以实现这一点的项目,可以查看 Apache Calcite:它在各种基本上是键值存储的概念之上提供了一个 SQL 解析器和查询优化器。

英文:

To do this using H2 constructs, you're going to want to implement a TableEngine. The features documentation says a little bit more about this. Hacking the actual H2 source code should be unnecessary.

For a project that does this already, see Apache Calcite: it parks a SQL parser and query optimizer on top of various notions of what are basically key-value stores.

huangapple
  • 本文由 发表于 2020年8月14日 22:05:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/63414325.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定