account_metastore_assignments
Creates, updates, deletes, gets or lists an account_metastore_assignments resource.
Overview​
| Name | account_metastore_assignments |
| Type | Resource |
| Id | databricks_account.catalog.account_metastore_assignments |
Fields​
The following fields are returned by SELECT queries:
- account_metastore_assignments_get
- account_metastore_assignments_list
| Name | Datatype | Description |
|---|---|---|
metastore_id | string | The unique ID of the metastore. |
workspace_id | integer | |
default_catalog_name | string | The 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. |
| Name | Datatype | Description |
|---|---|---|
workspaces | array |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
account_metastore_assignments_get | select | account_id, workspace_id, account_host | Gets the metastore assignment, if any, for the workspace specified by ID. If the workspace is assigned | |
account_metastore_assignments_list | select | account_id, metastore_id, account_host | Gets a list of all Databricks workspace IDs that have been assigned to given metastore. | |
account_metastore_assignments_create | insert | account_id, workspace_id, metastore_id, account_host | Creates an assignment to a metastore for a workspace | |
account_metastore_assignments_update | replace | account_id, workspace_id, metastore_id, account_host | Updates an assignment to a metastore for a workspace. Currently, only the default catalog may be | |
account_metastore_assignments_delete | delete | account_id, workspace_id, metastore_id, account_host | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
account_host | string | The 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_id | string | |
metastore_id | string | Unity Catalog metastore ID |
workspace_id | integer | Workspace ID. |
SELECT examples​
- account_metastore_assignments_get
- account_metastore_assignments_list
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
;
Gets a list of all Databricks workspace IDs that have been assigned to given metastore.
SELECT
workspaces
FROM databricks_account.catalog.account_metastore_assignments
WHERE account_id = '{{ account_id }}' -- required
AND metastore_id = '{{ metastore_id }}' -- required
AND account_host = '{{ account_host }}' -- required
;
INSERT examples​
- account_metastore_assignments_create
- Manifest
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 }}'
;
# Description fields are for documentation purposes
- name: account_metastore_assignments
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the account_metastore_assignments resource.
- name: workspace_id
value: {{ workspace_id }}
description: Required parameter for the account_metastore_assignments resource.
- name: metastore_id
value: "{{ metastore_id }}"
description: Required parameter for the account_metastore_assignments resource.
- name: account_host
value: "{{ account_host }}"
description: Required parameter for the account_metastore_assignments resource.
- name: metastore_assignment
value:
workspace_id: {{ workspace_id }}
metastore_id: "{{ metastore_id }}"
default_catalog_name: "{{ default_catalog_name }}"
REPLACE examples​
- account_metastore_assignments_update
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​
- account_metastore_assignments_delete
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
;