Vinayak Kulkarni
Vinayak Kulkarni

Reputation: 31

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?

Upvotes: 3

Views: 1447

Answers (2)

Michael Golos
Michael Golos

Reputation: 2059

You can import all tables into Snowflake and then create views that combine these tables so that they are visible as one view.

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;

Upvotes: 0

Simeon Pilgrim
Simeon Pilgrim

Reputation: 25978

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.

Upvotes: 1

Related Questions