cancel
Showing results for 
Search instead for 
Did you mean: 
What's New in Databricks
cancel
Showing results for 
Search instead for 
Did you mean: 
Sujitha
Community Manager
Community Manager

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.


VIEWS

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:

  1. In your Databricks workspace, select Catalog.
  2. In the left pane, expand the Delta Sharing menu and select Shared by me.
  3. On the Shares tab, find the share you want to add a view to and click its name.
    Screenshot 2023-09-14 at 12.10.53 AM.png
  4. Click Manage assets > Add data assets.
  5. On the Add tables page, search or browse for the view that you want to share and select it.
  6. (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.
  7. Click Save.

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>

   [COMMENT "<comment>"]

   [AS <alias>];

Options include:

  • 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.

Permissions required: 

  • 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.

Additional requirements:

  • 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.

 

SCHEMA

Option 1 - Data Catalog

  1. In your Databricks workspace, click Catalog.
  2. In the left pane, expand the Delta Sharing menu and select Shared by me.

  3. On the Shares tab, find the share you want to add a table to and click its name.

  4. Click Manage assets > Add data assets.

  5. On the Add 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. See Search for workspace objects.
  • To select a schema, first select the catalog and then the schema. For detailed information about sharing schemas, see Add schemas to a share.

     

Option 2 - SQL

Run the following SQL command in a notebook or the SQL editor: 

ALTER SHARE <share-name> ADD SCHEMA <catalog-name>.<schema-name>

[COMMENT "<comment>"];

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.

Permissions required:

  • Owner of the share object and owner of the schema (or a user with USE SCHEMA and SELECT privileges on the schema).

Additional requirements:

  • SQL warehouse on SQL compute version 2023.35 or above; or
  • Cluster running Databricks Runtime 13.2 or above. 
  • Doing the same using Data Explorer has no computing requirements.

 

Resources