Cross Warehouse Queries in Fabric – Query Across Warehouses with T-SQL | Microsoft Fabric Tutorial

Cross Warehouse Queries in Fabric – Query Across Warehouses with T-SQL | Microsoft Fabric Tutorial

Cross Warehouse Queries in Fabric – Query Across Warehouses with T-SQL

In Microsoft Fabric, you can execute cross warehouse queries to join or fetch data from multiple warehouses within the same workspace using standard T-SQL. This is useful for creating unified reports, performing analytics across departments, or consolidating data silos.

๐Ÿ“˜ What Are Cross Warehouse Queries?

  • Allows querying across two or more Fabric Warehouses
  • Supports read-only access to external warehouse tables
  • Uses Linked Server-style 3-part or 4-part naming convention
  • Enables you to join data without ETL duplication

✅ Prerequisites

  • Both warehouses must be in the same workspace
  • You must have read permissions on the external warehouse
  • SQL editor must be used within a Fabric Warehouse context

๐Ÿงช Example Query

Assume you are connected to SalesWarehouse and want to pull data from FinanceWarehouse:

SELECT o.OrderID, o.CustomerID, f.Balance
FROM dbo.Orders o
JOIN [FinanceWarehouse].[dbo].[CustomerAccounts] f
  ON o.CustomerID = f.CustomerID;

This query joins the Orders table from the current warehouse with the CustomerAccounts table from the FinanceWarehouse.

๐ŸŽฏ Use Cases

  • Central reporting across multiple business domains
  • Joining data from regional and global warehouses
  • Performing data validation across systems
  • Avoiding ETL and staging for short-term analytics

⚠️ Limitations

  • Write operations (INSERT, UPDATE) are not allowed on external warehouse tables
  • Performance depends on table sizes and Fabric capacity
  • Cross queries are scoped to the same workspace only
  • Only supported in SQL Editor, not in Dataflow Gen2 or Power BI visuals directly

๐Ÿ’ก Tips for Efficient Cross Warehouse Queries

  • Use TOP or WHERE clauses to limit data early
  • Apply indexing strategies on foreign keys in both warehouses
  • Use SELECT ... INTO to materialize external data into local staging tables if needed repeatedly

๐ŸŽฌ Watch the Full Tutorial

Blog post written with the help of ChatGPT.