Skip to content

unitycatalog.shares

The classes of the shares API.

Classes

Name Description
DataObject  
DataObjectUpdate Data object update.
GetSharePermissionsResponse Response to list shares.
ListSharesResponse Response to list shares.
Partition A partition specification: the conjunction of its partition values.
PartitionValue A partition column value a shared table is restricted to.
Share  
ShareClient The requests on one Share.
SharePermissionsChange  
SharePrivilegeAssignment  
UpdateSharePermissionsResponse  

Enums

Name Description
Action  
DataObjectStatus Whether a shared data object is still accessible to the share.
DataObjectType The server shares TABLE, VOLUME and AGENT_SKILL objects, and refuses the other types.
HistoryStatus  
PartitionValueOp The operator a partition value is matched with.

class unitycatalog.shares.DataObject(name: str,data_object_type: DataObjectType | str,*,added_at: SupportsIndex | None = None,added_by: str | None = None,comment: str | None = None,shared_as: str | None = None,partitions: SupportsGetItem[int, Partition] | None = None,cdf_enabled: bool | None = None,history_data_sharing_status: HistoryStatus | str | None = None,start_version: SupportsIndex | None = None,string_shared_as: str | None = None,status: DataObjectStatus | str | None = None,)

Attributes

  • added_at (int | None) – The time when this data object is added to the share, in epoch milliseconds.
  • added_by (str | None) – Username of the sharer.
  • cdf_enabled (bool | None) – Whether to enable cdf or indicate if cdf is enabled on the shared object.
  • comment (str | None) – A user-provided comment when adding the data object to the share.
  • data_object_type (DataObjectType | None) – Type of the data object.
  • history_data_sharing_status (HistoryStatus | None) – Whether to enable or disable sharing of data history. If not specified, the default is DISABLED.
  • name (str) – A fully qualified name that uniquely identifies a data object.
  • partitions (list[Partition]) – Array of partitions for the shared data.
  • shared_as (str | None) – A user-provided new name for the data object within the share.
  • start_version (int | None) – The start version associated with the object.
  • status (DataObjectStatus | None) – Whether the data object is still accessible to the share.
  • string_shared_as (str | None) – A user-provided alias for a non-table data object (e.g. a volume) within the share.

class unitycatalog.shares.DataObjectUpdate(action: Action | str, data_object: DataObject)

Data object update.

Attributes

  • action (Action | None) – The action to perform on the data object.
  • data_object (DataObject | None) – The data object that is being added, removed, or updated.

class unitycatalog.shares.GetSharePermissionsResponse

Response to list shares.

Attributes

  • next_page_token (str | None) – Opaque pagination token to go to next page based on previous query.
  • privilege_assignments (list[SharePrivilegeAssignment]) – The privileges assigned to each principal

class unitycatalog.shares.ListSharesResponse

Response to list shares.

Attributes

  • next_page_token (str | None) – Opaque pagination token to go to next page based on previous query.
  • shares (list[Share]) – List of shares.

class unitycatalog.shares.Partition(*, values: SupportsGetItem[int, PartitionValue] | None = None)

A partition specification: the conjunction of its partition values.

Attributes

class unitycatalog.shares.PartitionValue(name: str,*,value: str | None = None,recipient_property_key: str | None = None,op: PartitionValueOp | str | None = None,)

A partition column value a shared table is restricted to.

Attributes

  • name (str) – The name of the partition column.
  • op (PartitionValueOp | None) – The operator to apply for the value.
  • recipient_property_key (str | None) – The key of a Delta Sharing recipient property whose value the partition column is matched against, e.g. "databricks-account-id".
  • value (str | None) – The value of the partition column; unset means a null value.

class unitycatalog.shares.Share

Attributes

  • comment (str | None) – User-provided free-form text description.
  • created_at (int | None) – Time at which this share was created, in epoch milliseconds.
  • created_by (str | None) – Username of the creator of the share.
  • id (str | None) – Unique ID of the share.
  • name (str) – Name of the share.
  • objects (list[DataObject]) – A list of shared data objects within the share.
  • owner (str | None) – Username of current owner of share.
  • storage_location (str | None) – Storage Location URL (full path) for the share.
  • storage_root (str | None) – Storage root URL for the share.
  • updated_at (int | None) – Time at which this share was updated, in epoch milliseconds.
  • updated_by (str | None) – Username of share updater.

class unitycatalog.shares.ShareClient

The requests on one Share.

delete() → None

Deletes a share.

Async: delete_async(…) → Future[None]

get(*, include_shared_data: bool | None = None) → Share

Get a share by name.

Parameters

  • include_shared_data (bool | None, optional) – Query for data to include in the share.

Returns

  • Share – The requested resource

Async: get_async(…) → Future[Share]

get_share_permissions(*,max_results: SupportsIndex | None = None,page_token: str | None = None,) → GetSharePermissionsResponse

Gets the permissions for a data share from the metastore.

Parameters

  • max_results (SupportsIndex | None, optional) – The maximum number of results per page that should be returned. If unset or 0, the server's default page size is used. Negative values are rejected.
  • page_token (str | None, optional) – Opaque pagination token to go to next page based on previous query.

Returns

Async: get_share_permissions_async(…) → Future[GetSharePermissionsResponse]

update(*,updates: SupportsGetItem[int, DataObjectUpdate] | None = None,new_name: str | None = None,owner: str | None = None,comment: str | None = None,) → Share

Update a share.

Parameters

  • updates (SupportsGetItem[int, DataObjectUpdate] | None, optional) – Array of shared data object updates. At most 100 data objects may be updated per request.
  • new_name (str | None, optional) – A new name for the share.
  • owner (str | None, optional) – Owner of the share.
  • comment (str | None, optional) – User-provided free-form text description.

Returns

  • Share – The requested resource

Async: update_async(…) → Future[Share]

update_share_permissions(*,changes: SupportsGetItem[int, SharePermissionsChange] | None = None,omit_permissions_list: bool | None = None,) → UpdateSharePermissionsResponse

Updates the permissions for a data share in the metastore.

Parameters

  • changes (SupportsGetItem[int, SharePermissionsChange] | None, optional) – Array of permissions change objects.
  • omit_permissions_list (bool | None, optional) – Whether to return the latest permissions list of the share in the response.

Returns

Async: update_share_permissions_async(…) → Future[UpdateSharePermissionsResponse]

class unitycatalog.shares.SharePermissionsChange(*,principal: str | None = None,add: SupportsGetItem[int, str] | None = None,remove: SupportsGetItem[int, str] | None = None,)

Attributes

  • add (list[str]) – The set of privileges to add.
  • principal (str) – The principal (user email address or group name).
  • remove (list[str]) – The set of privileges to remove.

class unitycatalog.shares.SharePrivilegeAssignment

Attributes

  • principal (str) – The principal (user email address or group name).
  • privileges (list[str]) – The privileges assigned to the principal.

class unitycatalog.shares.UpdateSharePermissionsResponse

Attributes

class unitycatalog.shares.Action

Members

  • ADD
  • REMOVE
  • UPDATE

class unitycatalog.shares.DataObjectStatus

Whether a shared data object is still accessible to the share.

Members

  • ACTIVE – The data object is accessible.
  • PERMISSION_DENIED – The share owner lost access to the data object.

class unitycatalog.shares.DataObjectType

The server shares TABLE, VOLUME and AGENT_SKILL objects, and refuses the other types.

Members

  • TABLE
  • SCHEMA
  • VIEW
  • MATERIALIZED_VIEW
  • STREAMING_TABLE
  • MODEL
  • FUNCTION
  • VOLUME – A Unity Catalog volume shared as a storage-backed asset (OpenSharing).
  • AGENT_SKILL – An agent skill (a directory of SKILL.md + scripts/assets) shared as a storage-backed asset on top of a volume (OpenSharing).

class unitycatalog.shares.HistoryStatus

Members

  • DISABLED – Data history sharing is disabled.
  • ENABLED – Data history sharing is enabled.

class unitycatalog.shares.PartitionValueOp

The operator a partition value is matched with.

Members

  • EQUAL – The partition column equals the value.
  • LIKE – The partition column matches the value as a SQL LIKE pattern.