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_id, account_hostGets the metastore assignment, if any, for the workspace specified by ID. If the workspace is assigned
account_metastore_assignments_listselectaccount_id, metastore_id, account_hostGets a list of all Databricks workspace IDs that have been assigned to given metastore.
account_metastore_assignments_createinsertaccount_id, workspace_id, metastore_id, account_hostCreates an assignment to a metastore for a workspace
account_metastore_assignments_updatereplaceaccount_id, workspace_id, metastore_id, account_hostUpdates an assignment to a metastore for a workspace. Currently, only the default catalog may be
account_metastore_assignments_deletedeleteaccount_id, workspace_id, metastore_id, account_hostDeletes 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_hoststringThe Databricks account console host. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws), or set explicitly with DATABRICKS_ACCOUNT_HOST (bare host, no scheme). (default: accounts.cloud.databricks.com, x-stackQL-envVar: DATABRICKS_ACCOUNT_HOST, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"accounts.cloud.databricks.com","azure":"accounts.azuredatabricks.net","gcp":"accounts.gcp.databricks.com"}})
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
AND account_host = '{{ account_host }}' -- 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,
account_host
)
SELECT
'{{ metastore_assignment }}',
'{{ account_id }}',
'{{ workspace_id }}',
'{{ metastore_id }}',
'{{ account_host }}'
;

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
AND account_host = '{{ account_host }}' --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
AND account_host = '{{ account_host }}' --required
;