a.metastore_assignments: Account Metastore Assignments

class databricks.sdk.service.catalog.AccountMetastoreAssignmentsAPI

These APIs manage metastore assignments to a workspace.

create(workspace_id: int, metastore_id: str [, metastore_assignment: Optional[CreateMetastoreAssignment]])

Assigns a workspace to a metastore.

Creates an assignment to a metastore for a workspace

Parameters:
  • workspace_id – int Workspace ID.

  • metastore_id – str Unity Catalog metastore ID

  • metastore_assignmentCreateMetastoreAssignment (optional)

delete(workspace_id: int, metastore_id: str)

Delete a metastore assignment.

Deletes a metastore assignment to a workspace, leaving the workspace with no metastore.

Parameters:
  • workspace_id – int Workspace ID.

  • metastore_id – str Unity Catalog metastore ID

get(workspace_id: int) AccountsMetastoreAssignment

Gets the metastore assignment for a workspace.

Gets the metastore assignment, if any, for the workspace specified by ID. If the workspace is assigned a metastore, the mappig will be returned. If no metastore is assigned to the workspace, the assignment will not be found and a 404 returned.

Parameters:

workspace_id – int Workspace ID.

Returns:

AccountsMetastoreAssignment

list(metastore_id: str) Iterator[int]

Usage:

import os

from databricks.sdk import AccountClient

a = AccountClient()

ws = a.metastore_assignments.list(metastore_id=os.environ["TEST_METASTORE_ID"])

Get all workspaces assigned to a metastore.

Gets a list of all Databricks workspace IDs that have been assigned to given metastore.

Parameters:

metastore_id – str Unity Catalog metastore ID

Returns:

Iterator over int

update(workspace_id: int, metastore_id: str [, metastore_assignment: Optional[UpdateMetastoreAssignment]])

Updates a metastore assignment to a workspaces.

Updates an assignment to a metastore for a workspace. Currently, only the default catalog may be updated.

Parameters:
  • workspace_id – int Workspace ID.

  • metastore_id – str Unity Catalog metastore ID

  • metastore_assignmentUpdateMetastoreAssignment (optional)