如何在Apache Superset中跨多个数据库查询?

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

How to query across multiple databases in Apache Superset?

问题

我需要根据SQL查询显示图表,但我必须编写查询来连接来自不同数据库的表格。在Apache Superset中是否有任何方法可以做到这一点?

我查看了Trino,但想知道是否有更好的方法,因为我们在Kubernetes上运行Superset,而且我们必须在我们的Kubernetes集群中部署Trino。

英文:

I need to display charts based on SQL queries, but I have to write queries to join tables which are from different databases. Is there anyway I can do it in Apache Superset ?

I looked into Trino, but wondering if there is a better way as we are running Superset on kubernettes and we have to deploy Trino in our kubernettes cluster.

答案1

得分: 1

我认为目前您无法同时查询多个数据库。
一种解决方法是在主查询中使用类似于Postgres dblink函数的方式来从远程数据库检索数据。

另一种解决方法是:(1)创建一个视图(材料化视图)或(2)在主数据库上生成一个带有所需数据的外部表。然后,您可以只从一个数据库查询并使用Superset过滤器。

英文:

I think currently you can't query more than one DB at once.
A workaround would be to use something similar to Postgres dblink function on your main query to retrieve data from a remote DB.

Another solutions would be to (1) create a view (materialized view) or (2) to generate a foreign table on your main DB with required data from the remote DB.
Then, you can query only from one DB and use Superset filters.

huangapple
  • 本文由 发表于 2023年7月3日 16:33:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76603089.html
匿名

发表评论

匿名网友

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

确定