简体   繁体   English

SnowFlake 中的联合查询?

[英]Federated queries in SnowFlake?

I have three organizations which want to collaborate.我有三个想要合作的组织。 All three of them have the same backend database and tables, and want to run a federated query across these three tables.他们三个都有相同的后端数据库和表,并且想要跨这三个表运行联合查询。 Is that possible using snowflake?使用雪花可以吗?

If they each have one "table" each, and data share it to the other two, that can have the three "tables" and如果他们每个人都有一个“表”,并且数据共享给另外两个,那么可以有三个“表”和

SELECT a.*, b.*, c.*
FROM mytable AS a
JOIN their_table_one AS b
JOIN the_other_table AS c

just fine.正好。

You can import all tables into Snowflake and then create views that combine these tables so that they are visible as one view.您可以将所有表导入 Snowflake,然后创建组合这些表的视图,以便它们作为一个视图可见。

Example:例子:

CREATE VIEW Table1_v
AS
SELECT col1, col2, col3, 'Source A' AS src
  FROM SourceA_Table1
 UNION ALL
SELECT col1, col2, col3, 'Source B' AS src
  FROM SourceB_Table1
 UNION ALL
SELECT col1, col2, col3, 'Source C' AS src
  FROM SourceC_Table1;

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM