metastore_assignments
Operations on a metastore_assignments
resource.
Overview
Name | metastore_assignments |
Type | Resource |
Id | databricks_workspace.unitycatalog.metastore_assignments |
Fields
Name | Datatype |
---|---|
default_catalog_name | string |
metastore_id | string |
workspace_id | integer |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
current | SELECT | deployment_name | Gets the metastore assignment for the workspace being accessed. |
assign | INSERT | workspace_id, deployment_name | Creates a new metastore assignment. If an assignment for the same |
unassign | DELETE | metastore_id, workspace_id, deployment_name | Deletes a metastore assignment. The caller must be an account administrator. |
updateassignment | UPDATE | workspace_id, deployment_name | Updates 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.
- metastore_assignments
- Manifest
/*+ 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 }}'
;
- name: your_resource_model_name
props:
- name: metastore_id
value: string
- name: default_catalog_name
value: string
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 }}';