Delta Sharing is a great way to securely share data across different Unity Catalog metastores in your own Databricks account. This now includes using Delta Sharing to share views and schemas directly with other Databricks recipients from within the Delta Sharing UI or SQL.
How to get started
Follow the instructions below to share VIEWS and SCHEMAS to across different Unity Catalog metastores in your own Databricks account, using the UI or SQL.
You can add views to a share using Data Explorer, SQL commands,, Databricks CLI or Unity Catalog REST API. Below we will cover how to share via Data Explorer and SQL commands. For details on sharing via Databricks CLI or the REST API, click here.
Option 1 - Data Explorer:
In your Databricks workspace, select Catalog.
In the left pane, expand the Delta Sharing menu and select Shared by me.
On the Shares tab, find the share you want to add a view to and click its name.
Click Manage assets > Add data assets.
On the Add tables page, search or browse for the view that you want to share and select it.
(Optional) Click Advanced table options to specify an Alias, or alternate view name, to make the view name more readable. The alias is the name that the recipient sees and must use in queries. Recipients cannot use the actual view name if an alias is specified.
Option 2 - SQL Commands:
Run the following command in a notebook or the Databricks SQL query editor:
ALTER SHARE <share-name> ADD VIEW <catalog-name>.<schema-name>.<view-name>
AS <alias>: An alternate view name, or alias, to make the view name more readable. The alias is the view name that the recipient sees and must use in queries. Recipients cannot use the actual view name if an alias is specified.
COMMENT "<comment>": Comments appear in the Data Explorer UI and when you list and display view details using SQL statements.
For more information about ALTER SHARE options, see ALTER SHARE.
Owner of the share object, USE SCHEMA on the schema that contains the view, and SELECT on the view. You must maintain the SELECT privilege for as long as you want to share the view.
Shareable views must be defined on Delta tables or other shareable views.
You must use a SQL warehouse or a cluster on Databricks Runtime 13.1 or above when you add a view to a share.
Option 1 - Data Catalog
In your Databricks workspace, click Catalog.
In the left pane, expand theDelta Sharing menu and select Shared by me.
On theShares tab, find the share you want to add a table to and click its name.
ClickManage assets > Add data assets.
On theAdd tables page, select either an entire schema (database) or individual tables and views.
To select a table or view, first select the catalog, then the schema that contains the table or view, then the table or view itself. You can search for tables by name, column name, or comment using workspace search. SeeSearch for workspace objects.
To select a schema, first select the catalog and then the schema. For detailed information about sharing schemas, seeAdd schemas to a share.
Option 2 - SQL
Run the following SQL command in a notebook or the SQL editor:
When you add an entire schema to a share, your recipients will have access not only to all of the data assets in the schema at the time that you create the share, but any assets that are added to the schema over time. Tables shared this way always include full history.
Advanced table options, such as table aliases and partitions, are not available if you select an entire schema. If you have created aliases or partitions for any tables in the schema, these are removed when you add the entire schema to the share.
If you want to specify advanced options for a table that you are sharing using schema sharing, you must share the table using SQL and give the table an alias with a different schema name.
For more information on sharing via CLI, click here.