metastore_assignments
Operations on a metastore_assignments
resource.
Overview
Name | metastore_assignments |
Type | Resource |
Id | databricks_account.unity_catalog.metastore_assignments |
Fields
Name | Datatype |
---|---|
default_catalog_name | string |
metastore_id | string |
workspace_id | integer |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | account_id, workspace_id | Gets 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. |
create | INSERT | account_id, metastore_id, workspace_id | Creates an assignment to a metastore for a workspace |
delete | DELETE | account_id, metastore_id, workspace_id | Deletes a metastore assignment to a workspace, leaving the workspace with no metastore. |
update | REPLACE | account_id, metastore_id, workspace_id | Updates 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.
- metastore_assignments
- Manifest
/*+ 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 }}'
;
- name: your_resource_model_name
props:
- name: metastore_assignment
value:
metastore_id: string
default_catalog_name: string
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 }}';