volumes
Operations on a volumes
resource.
Overview
Name | volumes |
Type | Resource |
Id | databricks_workspace.unitycatalog.volumes |
Fields
Name | Datatype |
---|---|
name | string |
catalog_name | string |
comment | string |
created_at | integer |
created_by | string |
full_name | string |
metastore_id | string |
owner | string |
schema_name | string |
storage_location | string |
updated_at | integer |
updated_by | string |
volume_id | string |
volume_type | string |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
list | SELECT | catalog_name, schema_name, deployment_name | Gets an array of volumes for the current metastore under the parent catalog and schema. |
read | SELECT | name, deployment_name | Gets a volume from the metastore for a specific catalog and schema. |
create | INSERT | deployment_name | Creates a new volume. |
delete | DELETE | name, deployment_name | Deletes a volume from the specified parent catalog and schema. |
update | UPDATE | name, deployment_name | Updates the specified volume under the specified parent catalog and schema. |
SELECT
examples
- volumes (read)
- volumes (list)
SELECT
name,
catalog_name,
comment,
created_at,
created_by,
full_name,
metastore_id,
owner,
schema_name,
storage_location,
updated_at,
updated_by,
volume_id,
volume_type
FROM databricks_workspace.unitycatalog.volumes
WHERE name = '{{ name }}' AND
deployment_name = '{{ deployment_name }}';
SELECT
name,
catalog_name,
comment,
created_at,
created_by,
full_name,
metastore_id,
owner,
schema_name,
storage_location,
updated_at,
updated_by,
volume_id,
volume_type
FROM databricks_workspace.unitycatalog.volumes
WHERE catalog_name = '{{ catalog_name }}' AND
schema_name = '{{ schema_name }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new volumes
resource.
- volumes
- Manifest
/*+ create */
INSERT INTO databricks_workspace.unitycatalog.volumes (
deployment_name,
data__catalog_name,
data__schema_name,
data__name,
data__volume_type,
data__storage_location,
data__comment
)
SELECT
'{{ deployment_name }}',
'{{ catalog_name }}',
'{{ schema_name }}',
'{{ name }}',
'{{ volume_type }}',
'{{ storage_location }}',
'{{ comment }}'
;
- name: your_resource_model_name
props:
- name: catalog_name
value: main
- name: schema_name
value: default
- name: name
value: my_volume
- name: volume_type
value: EXTERNAL
- name: storage_location
value: s3://my-bucket/hello/world/my-volume
- name: comment
value: This is my first volume
UPDATE
example
Updates a volumes
resource.
/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.unitycatalog.volumes
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE name = '{{ name }}' AND
deployment_name = '{{ deployment_name }}';
DELETE
example
Deletes a volumes
resource.
/*+ delete */
DELETE FROM databricks_workspace.unitycatalog.volumes
WHERE name = '{{ name }}' AND
deployment_name = '{{ deployment_name }}';