Mohammad Gufran Jahangir August 18, 2025 0

Delta Sharing lets you publish live, governed data to other teams or external partners—without copying files or building custom APIs. Recipients can query the latest data directly from their tools (Databricks, Spark, pandas, BI tools, and more). (Databricks Documentation, Delta)


TL;DR

  • Provider: Create a share → add tables/views/etc. → create a recipientgrant access.
  • Recipient (Databricks workspace): Create catalog using the share and query immediately.
  • Recipient (open sharing): Use a credential file with open-source connectors (Spark/pandas/BI). (Databricks Documentation)

Core concepts (30 seconds)

  • Share: Read-only bundle of data assets (tables, table partitions, views including dynamic views, materialized views, streaming tables, managed Iceberg tables, volumes, and even notebooks & AI models). It lives in Unity Catalog. (Microsoft Learn)
  • Recipient: Who is allowed to read from the share (another Databricks workspace or an “open sharing” consumer). (Databricks Documentation)
  • Provider: You—the owner who is sharing the data. (Databricks Documentation)

Provider flow (SQL you can paste)

Requires metastore admin or the right metastore-level privileges.

  1. Create a share
CREATE SHARE IF NOT EXISTS fin_share COMMENT 'Finance curated data';
  1. Add objects to the share (tables, views, schemas, models, etc.)
-- Add a table; optionally expose it under a different name and include history
ALTER SHARE fin_share
  ADD TABLE prod.finance.gold.sales
  COMMENT 'Monthly sales'
  AS shared_fin.gold_sales
  WITH HISTORY;  -- enables time travel for recipients

You can also share entire schemas, views, materialized views, and more. (Databricks Documentation)

  1. Create a recipient (Databricks-to-Databricks)
CREATE RECIPIENT IF NOT EXISTS acme_recip
  USING ID '<acme_sharing_identifier>';  -- recipient’s UC metastore ID

Use DESCRIBE RECIPIENT acme_recip to see the activation link if needed. (Microsoft Learn, Databricks Documentation)

  1. Grant the share to the recipient
GRANT SELECT ON SHARE fin_share TO RECIPIENT acme_recip;

SELECT is the only privilege on a share. Revoke with
REVOKE SELECT ON SHARE fin_share FROM RECIPIENT acme_recip; (Microsoft Learn)

  1. Audit
SHOW GRANTS ON SHARE fin_share;         -- who has access
SHOW GRANTS TO RECIPIENT acme_recip;    -- which shares a recipient can read
SHOW ALL IN SHARE fin_share;            -- list shared objects & history flags

(Databricks Documentation)


Recipient flow (Databricks ↔ Databricks)

On the recipient workspace (Unity Catalog enabled):

  1. Create a catalog backed by the provider’s share
CREATE CATALOG acme_fin USING SHARE provider_name.fin_share;
  • provider_name is the name of the provider object that represents the sharer in your metastore.
  • The catalog appears under Delta Shares Received and is read-only. (Databricks Documentation, Medium)
  1. Query the data
USE CATALOG acme_fin;
SELECT * FROM shared_fin.gold_sales LIMIT 10;

Recipient flow (Open sharing to non-Databricks tools)

  1. Provider sends an activation link; your teammate downloads a credential profile (JSON). (Databricks Documentation)
  2. Use a connector (Spark or pandas via the delta-sharing library):

Spark

-- one-time table mapping
CREATE TABLE myshare_sales
USING deltaSharing
LOCATION '/path/to/profile.json#fin_share.shared_fin.gold_sales';

SELECT * FROM myshare_sales;

Python / pandas

import delta_sharing
client = delta_sharing.SharingClient("file:/path/to/profile.json")
for t in client.list_all_tables():
    print(t)

# Or load via Spark with format("deltaSharing")

(Install with pip install delta-sharing.) (Delta Lake Documentation, GitHub)


Design tips (what I actually recommend)

  • Share the smallest useful surface: a curated schema or a handful of purpose-built views (often dynamic views with row/column masking). This keeps contracts stable and safe.
  • Use WITH HISTORY when recipients need time travel (or streaming reads); enable CDF on the source table if they’ll call table_changes(). (Databricks Documentation)
  • Treat privileges like code: manage shares/recipients with the Databricks CLI or Terraform (databricks_share, databricks_recipient, databricks_grants). (Terraform Registry)
  • Monitor & rotate: regularly review SHOW GRANTS and rotate open-sharing credentials on a schedule. (Microsoft Learn)

Common gotchas

  • Recipient can’t see the share → Ensure you granted SELECT ON SHARE … TO RECIPIENT … and the recipient created the catalog using the share. (Microsoft Learn, Databricks Documentation)
  • “Wrong table name” errors → The name inside the received catalog may use the alias you set with AS shared_schema.shared_tab. Verify with SHOW ALL IN SHARE. (Databricks Documentation)
  • Open sharing not working in Databricks? → That flow needs a credential profile; follow the “open sharing” docs (it’s different from D-to-D). (Databricks Documentation)

Copy-paste quickstart (all together)

Provider

CREATE SHARE IF NOT EXISTS fin_share;
ALTER SHARE fin_share ADD TABLE prod.finance.gold.sales AS shared_fin.gold_sales WITH HISTORY;
CREATE RECIPIENT IF NOT EXISTS acme_recip USING ID '<recipient_metastore_id>';
GRANT SELECT ON SHARE fin_share TO RECIPIENT acme_recip;
SHOW GRANTS ON SHARE fin_share;

Recipient (Databricks)

CREATE CATALOG acme_fin USING SHARE provider_name.fin_share;
USE CATALOG acme_fin;
SELECT * FROM shared_fin.gold_sales;

(Databricks Documentation, Microsoft Learn)


Wrap-up

Delta Sharing gives you a no-copy, governed way to deliver live data to anyone, inside or outside your org. Start with a minimal share, wire a recipient, and promote it to production with Terraform and a lightweight operating model (grants review + credential rotation). (Databricks Documentation, Terraform Registry)

If you want, I can add diagrams and a ready-to-run SQL notebook that provisions a demo share + a recipient catalog end-to-end.

Category: 
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments