Skip to main content

metastore_assignments

Operations on a metastore_assignments resource.

Overview

Namemetastore_assignments
TypeResource
Iddatabricks_account.unity_catalog.metastore_assignments

Fields

NameDatatype
default_catalog_namestring
metastore_idstring
workspace_idinteger

Methods

NameAccessible byRequired ParamsDescription
getSELECTaccount_id, workspace_idGets 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.
createINSERTaccount_id, metastore_id, workspace_idCreates an assignment to a metastore for a workspace
deleteDELETEaccount_id, metastore_id, workspace_idDeletes a metastore assignment to a workspace, leaving the workspace with no metastore.
updateREPLACEaccount_id, metastore_id, workspace_idUpdates an assignment to a metastore for a workspace. Currently, only the default catalog may be updated.

SELECT examples

SELECT
default_catalog_name,
metastore_id,
workspace_id
FROM databricks_account.unity_catalog.metastore_assignments
WHERE account_id = '{{ account_id }}' AND
workspace_id = '{{ workspace_id }}';

INSERT example

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

/*+ create */
INSERT INTO databricks_account.unity_catalog.metastore_assignments (
account_id,
metastore_id,
workspace_id,
data__metastore_assignment
)
SELECT
'{{ account_id }}',
'{{ metastore_id }}',
'{{ workspace_id }}',
'{{ metastore_assignment }}'
;

REPLACE example

Replaces a metastore_assignments resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
REPLACE databricks_account.unity_catalog.metastore_assignments
SET field1 = '{ value1 }',
field2 = '{ value2 }', ...
WHERE account_id = '{{ account_id }}' AND
metastore_id = '{{ metastore_id }}' AND
workspace_id = '{{ workspace_id }}';

DELETE example

Deletes a metastore_assignments resource.

/*+ delete */
DELETE FROM databricks_account.unity_catalog.metastore_assignments
WHERE account_id = '{{ account_id }}' AND
metastore_id = '{{ metastore_id }}' AND
workspace_id = '{{ workspace_id }}';