Skip to main content

account_metastore_assignments

Creates, updates, deletes, gets or lists an account_metastore_assignments resource.

Overview

Nameaccount_metastore_assignments
TypeResource
Iddatabricks_account.catalog.account_metastore_assignments

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
metastore_idstringThe unique ID of the metastore.
workspace_idinteger
default_catalog_namestringThe name of the default catalog in the metastore. This field is deprecated. Please use "Default Namespace API" to configure the default catalog for a Databricks workspace.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
account_metastore_assignments_getselectaccount_id, workspace_idGets the metastore assignment, if any, for the workspace specified by ID. If the workspace is assigned
account_metastore_assignments_listselectaccount_id, metastore_idGets a list of all Databricks workspace IDs that have been assigned to given metastore.
account_metastore_assignments_createinsertaccount_id, workspace_id, metastore_idCreates an assignment to a metastore for a workspace
account_metastore_assignments_updatereplaceaccount_id, workspace_id, metastore_idUpdates an assignment to a metastore for a workspace. Currently, only the default catalog may be
account_metastore_assignments_deletedeleteaccount_id, workspace_id, metastore_idDeletes a metastore assignment to a workspace, leaving the workspace with no metastore.

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
account_idstring
metastore_idstringUnity Catalog metastore ID
workspace_idintegerWorkspace ID.

SELECT examples

Gets the metastore assignment, if any, for the workspace specified by ID. If the workspace is assigned

SELECT
metastore_id,
workspace_id,
default_catalog_name
FROM databricks_account.catalog.account_metastore_assignments
WHERE account_id = '{{ account_id }}' -- required
AND workspace_id = '{{ workspace_id }}' -- required
;

INSERT examples

Creates an assignment to a metastore for a workspace

INSERT INTO databricks_account.catalog.account_metastore_assignments (
metastore_assignment,
account_id,
workspace_id,
metastore_id
)
SELECT
'{{ metastore_assignment }}',
'{{ account_id }}',
'{{ workspace_id }}',
'{{ metastore_id }}'
;

REPLACE examples

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

REPLACE databricks_account.catalog.account_metastore_assignments
SET
metastore_assignment = '{{ metastore_assignment }}'
WHERE
account_id = '{{ account_id }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND metastore_id = '{{ metastore_id }}' --required;

DELETE examples

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

DELETE FROM databricks_account.catalog.account_metastore_assignments
WHERE account_id = '{{ account_id }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND metastore_id = '{{ metastore_id }}' --required
;