Skip to main content

metastore_assignments

Operations on a metastore_assignments resource.

Overview

Namemetastore_assignments
TypeResource
Iddatabricks_workspace.unitycatalog.metastore_assignments

Fields

NameDatatype
default_catalog_namestring
metastore_idstring
workspace_idinteger

Methods

NameAccessible byRequired ParamsDescription
currentSELECTdeployment_nameGets the metastore assignment for the workspace being accessed.
assignINSERTworkspace_id, deployment_nameCreates a new metastore assignment. If an assignment for the same
unassignDELETEmetastore_id, workspace_id, deployment_nameDeletes a metastore assignment. The caller must be an account administrator.
updateassignmentUPDATEworkspace_id, deployment_nameUpdates a metastore assignment. This operation can be used to update

SELECT examples

SELECT
default_catalog_name,
metastore_id,
workspace_id
FROM databricks_workspace.unitycatalog.metastore_assignments
WHERE deployment_name = '{{ deployment_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new metastore_assignments resource.

/*+ create */
INSERT INTO databricks_workspace.unitycatalog.metastore_assignments (
workspace_id,
deployment_name,
data__metastore_id,
data__default_catalog_name
)
SELECT
'{{ workspace_id }}',
'{{ deployment_name }}',
'{{ metastore_id }}',
'{{ default_catalog_name }}'
;

UPDATE example

Updates a metastore_assignments resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.unitycatalog.metastore_assignments
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE workspace_id = '{{ workspace_id }}' AND
deployment_name = '{{ deployment_name }}';

DELETE example

Deletes a metastore_assignments resource.

/*+ delete */
DELETE FROM databricks_workspace.unitycatalog.metastore_assignments
WHERE metastore_id = '{{ metastore_id }}' AND
workspace_id = '{{ workspace_id }}' AND
deployment_name = '{{ deployment_name }}';