metastores
Creates, updates, deletes, gets or lists a metastores resource.
Overview
| Name | metastores |
| Type | Resource |
| Id | databricks_workspace.catalog.metastores |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | The user-specified name of the metastore. |
default_data_access_config_id | string | Unique identifier of the metastore's (Default) Data Access Configuration. |
global_metastore_id | string | Globally unique metastore ID across clouds and regions, of the form `cloud:region:metastore_id`. |
metastore_id | string | Unique identifier of metastore. |
storage_root_credential_id | string | UUID of storage credential to access the metastore storage_root. |
delta_sharing_organization_name | string | The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. |
storage_root_credential_name | string | Name of the storage credential to access the metastore storage_root. |
cloud | string | |
created_at | integer | Time at which this metastore was created, in epoch milliseconds. |
created_by | string | Username of metastore creator. |
delta_sharing_recipient_token_lifetime_in_seconds | integer | The lifetime of delta sharing recipient token in seconds. |
delta_sharing_scope | string | The scope of Delta Sharing enabled for the metastore. (INTERNAL, INTERNAL_AND_EXTERNAL) |
external_access_enabled | boolean | Whether to allow non-DBR clients to directly access entities under the metastore. |
owner | string | The owner of the metastore. |
privilege_model_version | string | Privilege model version of the metastore, of the form `major.minor` (e.g., `1.0`). |
region | string | Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). |
storage_root | string | The storage root URL for metastore |
updated_at | integer | Time at which the metastore was last modified, in epoch milliseconds. |
updated_by | string | Username of user who last modified the metastore. |
| Name | Datatype | Description |
|---|---|---|
name | string | The user-specified name of the metastore. |
default_data_access_config_id | string | Unique identifier of the metastore's (Default) Data Access Configuration. |
global_metastore_id | string | Globally unique metastore ID across clouds and regions, of the form `cloud:region:metastore_id`. |
metastore_id | string | Unique identifier of metastore. |
storage_root_credential_id | string | UUID of storage credential to access the metastore storage_root. |
delta_sharing_organization_name | string | The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. |
storage_root_credential_name | string | Name of the storage credential to access the metastore storage_root. |
cloud | string | |
created_at | integer | Time at which this metastore was created, in epoch milliseconds. |
created_by | string | Username of metastore creator. |
delta_sharing_recipient_token_lifetime_in_seconds | integer | The lifetime of delta sharing recipient token in seconds. |
delta_sharing_scope | string | The scope of Delta Sharing enabled for the metastore. (INTERNAL, INTERNAL_AND_EXTERNAL) |
external_access_enabled | boolean | Whether to allow non-DBR clients to directly access entities under the metastore. |
owner | string | The owner of the metastore. |
privilege_model_version | string | Privilege model version of the metastore, of the form `major.minor` (e.g., `1.0`). |
region | string | Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). |
storage_root | string | The storage root URL for metastore |
updated_at | integer | Time at which the metastore was last modified, in epoch milliseconds. |
updated_by | string | Username of user who last modified the metastore. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id, deployment_name | Gets a metastore that matches the supplied ID. The caller must be a metastore admin to retrieve this | |
list | select | deployment_name | max_results, page_token | Gets an array of the available metastores (as MetastoreInfo objects). The caller must be an admin |
create | insert | deployment_name, name | Creates a new metastore based on a provided name and optional storage root path. By default (if the | |
update_assignment | update | workspace_id, deployment_name | Updates a metastore assignment. This operation can be used to update metastore_id or | |
update | update | id, deployment_name | Updates information for a specific metastore. The caller must be a metastore admin. If the owner | |
assign | replace | workspace_id, deployment_name, metastore_id, default_catalog_name | Creates a new metastore assignment. If an assignment for the same workspace_id exists, it will be | |
unassign | delete | workspace_id, metastore_id, deployment_name | Deletes a metastore assignment. The caller must be an account administrator. | |
delete | delete | id, deployment_name | force | Deletes a metastore. The caller must be a metastore admin. |
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 |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
id | string | Unique ID of the metastore. |
metastore_id | string | Query for the ID of the metastore to delete. |
workspace_id | integer | A workspace ID. |
force | boolean | Force deletion even if the metastore is not empty. Default is false. |
max_results | integer | Maximum number of metastores to return. - when set to a value greater than 0, the page length is the minimum of this value and a server configured value; - when set to 0, the page length is set to a server configured value (recommended); - when set to a value less than 0, an invalid parameter error is returned; - If not set, all the metastores are returned (not recommended). - Note: The number of returned metastores might be less than the specified max_results size, even zero. The only definitive indication that no further metastores can be fetched is when the next_page_token is unset from the response. |
page_token | string | Opaque pagination token to go to next page based on previous query. |
SELECT examples
- get
- list
Gets a metastore that matches the supplied ID. The caller must be a metastore admin to retrieve this
SELECT
name,
default_data_access_config_id,
global_metastore_id,
metastore_id,
storage_root_credential_id,
delta_sharing_organization_name,
storage_root_credential_name,
cloud,
created_at,
created_by,
delta_sharing_recipient_token_lifetime_in_seconds,
delta_sharing_scope,
external_access_enabled,
owner,
privilege_model_version,
region,
storage_root,
updated_at,
updated_by
FROM databricks_workspace.catalog.metastores
WHERE id = '{{ id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
Gets an array of the available metastores (as MetastoreInfo objects). The caller must be an admin
SELECT
name,
default_data_access_config_id,
global_metastore_id,
metastore_id,
storage_root_credential_id,
delta_sharing_organization_name,
storage_root_credential_name,
cloud,
created_at,
created_by,
delta_sharing_recipient_token_lifetime_in_seconds,
delta_sharing_scope,
external_access_enabled,
owner,
privilege_model_version,
region,
storage_root,
updated_at,
updated_by
FROM databricks_workspace.catalog.metastores
WHERE deployment_name = '{{ deployment_name }}' -- required
AND max_results = '{{ max_results }}'
AND page_token = '{{ page_token }}'
;
INSERT examples
- create
- Manifest
Creates a new metastore based on a provided name and optional storage root path. By default (if the
INSERT INTO databricks_workspace.catalog.metastores (
name,
external_access_enabled,
region,
storage_root,
deployment_name
)
SELECT
'{{ name }}' /* required */,
{{ external_access_enabled }},
'{{ region }}',
'{{ storage_root }}',
'{{ deployment_name }}'
RETURNING
name,
default_data_access_config_id,
global_metastore_id,
metastore_id,
storage_root_credential_id,
delta_sharing_organization_name,
storage_root_credential_name,
cloud,
created_at,
created_by,
delta_sharing_recipient_token_lifetime_in_seconds,
delta_sharing_scope,
external_access_enabled,
owner,
privilege_model_version,
region,
storage_root,
updated_at,
updated_by
;
# Description fields are for documentation purposes
- name: metastores
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the metastores resource.
- name: name
value: "{{ name }}"
description: |
The user-specified name of the metastore.
- name: external_access_enabled
value: {{ external_access_enabled }}
description: |
Whether to allow non-DBR clients to directly access entities under the metastore.
- name: region
value: "{{ region }}"
description: |
Cloud region which the metastore serves (e.g., `us-west-2`, `westus`).
- name: storage_root
value: "{{ storage_root }}"
description: |
The storage root URL for metastore
UPDATE examples
- update_assignment
- update
Updates a metastore assignment. This operation can be used to update metastore_id or
UPDATE databricks_workspace.catalog.metastores
SET
default_catalog_name = '{{ default_catalog_name }}',
metastore_id = '{{ metastore_id }}'
WHERE
workspace_id = '{{ workspace_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required;
Updates information for a specific metastore. The caller must be a metastore admin. If the owner
UPDATE databricks_workspace.catalog.metastores
SET
delta_sharing_organization_name = '{{ delta_sharing_organization_name }}',
delta_sharing_recipient_token_lifetime_in_seconds = {{ delta_sharing_recipient_token_lifetime_in_seconds }},
delta_sharing_scope = '{{ delta_sharing_scope }}',
external_access_enabled = {{ external_access_enabled }},
new_name = '{{ new_name }}',
owner = '{{ owner }}',
privilege_model_version = '{{ privilege_model_version }}',
storage_root_credential_id = '{{ storage_root_credential_id }}'
WHERE
id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
name,
default_data_access_config_id,
global_metastore_id,
metastore_id,
storage_root_credential_id,
delta_sharing_organization_name,
storage_root_credential_name,
cloud,
created_at,
created_by,
delta_sharing_recipient_token_lifetime_in_seconds,
delta_sharing_scope,
external_access_enabled,
owner,
privilege_model_version,
region,
storage_root,
updated_at,
updated_by;
REPLACE examples
- assign
Creates a new metastore assignment. If an assignment for the same workspace_id exists, it will be
REPLACE databricks_workspace.catalog.metastores
SET
metastore_id = '{{ metastore_id }}',
default_catalog_name = '{{ default_catalog_name }}'
WHERE
workspace_id = '{{ workspace_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND metastore_id = '{{ metastore_id }}' --required
AND default_catalog_name = '{{ default_catalog_name }}' --required;
DELETE examples
- unassign
- delete
Deletes a metastore assignment. The caller must be an account administrator.
DELETE FROM databricks_workspace.catalog.metastores
WHERE workspace_id = '{{ workspace_id }}' --required
AND metastore_id = '{{ metastore_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;
Deletes a metastore. The caller must be a metastore admin.
DELETE FROM databricks_workspace.catalog.metastores
WHERE id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND force = '{{ force }}'
;