Skip to main content

shares

Creates, updates, deletes, gets or lists a shares resource.

Overview

Nameshares
TypeResource
Iddatabricks_workspace.sharing.shares

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringName of the share.
commentstring
created_atintegerTime at which this share was created, in epoch milliseconds.
created_bystringUsername of share creator.
objectsarrayA list of shared data objects within the share.
ownerstringUsername of current owner of share.
storage_locationstringStorage Location URL (full path) for the share.
storage_rootstringStorage root URL for the share.
updated_atintegerTime at which this share was updated, in epoch milliseconds.
updated_bystringUsername of share updater.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, deployment_nameinclude_shared_dataGets a data object share from the metastore. The caller must have the USE_SHARE privilege on the
listselectdeployment_namemax_results, page_tokenGets an array of data object shares from the metastore. If the caller has the USE_SHARE privilege on
createinsertdeployment_name, nameCreates a new share for data objects. Data objects can be added after creation with update. The
updateupdatename, deployment_nameUpdates the share with the changes and data objects in the request. The caller must be the owner of
deletedeletename, deployment_nameDeletes a data object share from the metastore. The caller must be an owner of the share.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
namestringThe name of the share.
include_shared_databooleanQuery for data to include in the share.
max_resultsintegerMaximum number of shares to return. - when set to 0, the page length is set to a server configured value (recommended); - when set to a value greater than 0, the page length is the minimum of this value and a server configured value; - when set to a value less than 0, an invalid parameter error is returned; - If not set, all valid shares are returned (not recommended). - Note: The number of returned shares might be less than the specified max_results size, even zero. The only definitive indication that no further shares can be fetched is when the next_page_token is unset from the response.
page_tokenstringOpaque pagination token to go to next page based on previous query.

SELECT examples

Gets a data object share from the metastore. The caller must have the USE_SHARE privilege on the

SELECT
name,
comment,
created_at,
created_by,
objects,
owner,
storage_location,
storage_root,
updated_at,
updated_by
FROM databricks_workspace.sharing.shares
WHERE name = '{{ name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_shared_data = '{{ include_shared_data }}'
;

INSERT examples

Creates a new share for data objects. Data objects can be added after creation with update. The

INSERT INTO databricks_workspace.sharing.shares (
name,
comment,
storage_root,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ comment }}',
'{{ storage_root }}',
'{{ deployment_name }}'
RETURNING
name,
comment,
created_at,
created_by,
objects,
owner,
storage_location,
storage_root,
updated_at,
updated_by
;

UPDATE examples

Updates the share with the changes and data objects in the request. The caller must be the owner of

UPDATE databricks_workspace.sharing.shares
SET
comment = '{{ comment }}',
new_name = '{{ new_name }}',
owner = '{{ owner }}',
storage_root = '{{ storage_root }}',
updates = '{{ updates }}'
WHERE
name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
name,
comment,
created_at,
created_by,
objects,
owner,
storage_location,
storage_root,
updated_at,
updated_by;

DELETE examples

Deletes a data object share from the metastore. The caller must be an owner of the share.

DELETE FROM databricks_workspace.sharing.shares
WHERE name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;