Databricks courseLesson 8 of 13
Databricks course · Lesson 8 of 13
Sharing and Federation on Databricks: OpenSharing, Lakehouse Federation and Clean Rooms
Share data without copying it and query data where it lives: OpenSharing (formerly Delta Sharing), Lakehouse Federation for external databases and catalogs, and Clean Rooms.
On this page
Two requests reach every data platform sooner or later. “Can our partner get this data?” and “Can we query that database without building a pipeline first?” The old answers were file exports and copy jobs, which go stale and escape governance. Databricks answers the first with OpenSharing (formerly Delta Sharing) and Clean Rooms, and the second with Lakehouse Federation. All three are governed through Unity Catalog.
OpenSharing: share without copying
OpenSharing is an open protocol for sharing live data with other organisations. The recipient reads the provider’s current data directly from the provider’s storage through short-lived credentials; nothing is exported, and revoking access takes effect immediately.
Three objects, all registered in Unity Catalog on the provider side:
- A share is a read-only collection of assets: tables, table partitions, views (including dynamic views that filter rows per recipient), streaming tables, materialized views, volumes, models and notebooks.
- A recipient represents an organisation that receives shares.
- A provider represents the sharing organisation, as seen from the recipient’s side.
Two protocols
| Databricks-to-Databricks | Databricks-to-Open | |
|---|---|---|
| Recipient uses | A Unity Catalog-enabled Databricks workspace | Any platform: Spark, pandas, Power BI, other tools with an OpenSharing connector |
| How they connect | By their metastore’s sharing identifier; no token to manage | With a credential file (bearer token) or OIDC federation |
| What can be shared | Tables, views, volumes, models, notebooks and more | Mainly tabular data |
| Recipient experience | The share appears as a read-only catalog they can grant on in their own Unity Catalog | Read through a connector or client library |
Prefer Databricks-to-Databricks when the partner is on Databricks: there is no secret to hand over or rotate, and auditing is richer. The open-source OpenSharing server also lets non-Databricks platforms share with anyone.
Creating a share
-- Provider side
CREATE SHARE IF NOT EXISTS partner_sales
COMMENT 'Daily sales for Acme Retail';
ALTER SHARE partner_sales
ADD TABLE main.gold.daily_sales
WITH HISTORY; -- lets the recipient use time travel and change data feed
CREATE RECIPIENT IF NOT EXISTS acme_retail
USING ID 'aws:us-west-2:<their-metastore-uuid>'; -- Databricks-to-Databricks
GRANT SELECT ON SHARE partner_sales TO RECIPIENT acme_retail;
The recipient then creates a catalog from the share and grants its own users access:
-- Recipient side
CREATE CATALOG IF NOT EXISTS acme_sales_from_partner
USING SHARE provider_name.partner_sales;
Good practice for providers:
- Share views or prepared gold tables, not raw silver tables, so recipients see only what the contract covers. A dynamic view can filter rows by recipient properties, so one share serves several partners.
- Share with
WITH HISTORYwhen recipients need incremental reads; they can then stream changes instead of re-reading the table. - Audit access in
system.access.auditand revoke recipients that are no longer under contract.
Databricks Marketplace is built on the same protocol: providers publish data products and recipients subscribe to them.
Clean Rooms: collaborate without exposing raw data
Sometimes two companies want a joint result (overlap of customers, the reach of a campaign) but neither may see the other’s rows. A Clean Room is a governed space where each party shares tables, and only approved notebooks run on the combined data; the parties see the agreed outputs, not each other’s raw records. Typical uses are advertising measurement, retail media and fraud collaboration. Clean Rooms are built on OpenSharing, so data is not copied into a third party’s system.
Lakehouse Federation: query data where it lives
Federation registers an external system in Unity Catalog as a foreign catalog, so users query it with ordinary SQL and the same permissions model as everything else. Databricks offers two kinds:
| Query federation | Catalog federation | |
|---|---|---|
| Connects to | Relational databases such as PostgreSQL, MySQL, SQL Server, Oracle, Snowflake, Redshift, BigQuery | External catalogs such as a Hive metastore, AWS Glue or Snowflake’s catalog |
| How queries run | Pushed down to the external database over JDBC, with results returned to Databricks | Directly against the tables’ files in object storage, on Databricks compute |
| Writes | Read-only | Read-only |
| Best for | Ad hoc analysis, BI and proofs of concept on operational databases | Incremental migration to Unity Catalog, or a long-term hybrid setup |
Setting up query federation to a PostgreSQL database:
CREATE CONNECTION IF NOT EXISTS orders_pg TYPE postgresql
OPTIONS (
host 'orders-db.internal.example.com',
port '5432',
user secret('federation', 'pg_user'),
password secret('federation', 'pg_password')
);
CREATE FOREIGN CATALOG IF NOT EXISTS orders_live
USING CONNECTION orders_pg
OPTIONS (database 'orders');
GRANT USE CATALOG, USE SCHEMA, SELECT ON CATALOG orders_live TO `analysts`;
SELECT status, COUNT(*) FROM orders_live.public.orders GROUP BY status;
Credentials come from a secret scope, never from the SQL text. Unity Catalog applies permissions and records lineage for federated tables like any other.
Federation, sharing or ingestion?
Federation is convenient, but every query hits the source system. Use this rule:
- Federate for occasional queries, exploration, small lookups and proofs of concept, where freshness matters and volume is low.
- Ingest (with Lakeflow Connect, Auto Loader or a CDC pipeline) when the data is queried heavily, joined with large tables, or needs history. Repeated large federated queries load the production database and cost more than copying the data once.
- Share (OpenSharing) when the data crosses an organisation boundary and the other side should read your live copy instead of receiving files.
Common mistakes
- Sharing raw tables. Recipients see columns the contract never covered. Share curated views.
- Using federation as an ETL engine. Large scans through JDBC are slow and burden the source; ingest instead.
- Credentials in connection SQL. Use
secret()references. - Forgetting to revoke. Shares stay live until revoked; review recipients regularly.
- Assuming the old name is a different product. Delta Sharing and OpenSharing are the same thing.
Interview angle
“A partner wants a daily copy of our sales data. How would you deliver it?” Rather than exporting files, create a share with a curated view and add the partner as a recipient: Databricks-to-Databricks if they use Databricks, otherwise Databricks-to-Open. They read live data, access is audited, and revoking it is one command. If they must not see row-level data, propose a Clean Room. Contrast that with federation, which is for querying external databases, not for sending data out.
Key takeaway
Share live, governed data with OpenSharing instead of exporting files, use Clean Rooms when neither side may see the other’s raw data, and use Lakehouse Federation to query external databases and catalogs in place, switching to ingestion when queries become frequent or heavy.
Progress is saved in this browser only. No account needed.

