alterVolume
alterVolume
is a Change Type in the Liquibase Pro Databricks extension that alters a volume. It is available in the Liquibase Pro Databricks extension 1.0.0 and later.
Uses
You can use this change to alter the metadata of an existing Databricks volume, such as the volume's name, owner, comment, and tags.
For more information, see Databricks SQL Reference: ALTER VOLUME.
Run alterVolume
To run this Change Type, follow these steps:
- Add the Change Type to your changeset, as shown in the examples on this page.
- Specify any required attributes. Use the table on this page to see which ones your database requires.
- Deploy your changeset by running the
update
command:
liquibase update
Available attributes
Specify all required attributes. If you specify an optional attribute, you must also specify any required nested attributes.
Name | Type | Description | Requirement |
---|---|---|---|
volumeName
|
String | Name of the volume to create | Required |
catalogName
|
String |
Name of the catalog |
Optional |
schemaName
|
String |
Name of the schema |
Optional |
Changing two properties in one alterVolume
SQL statement is impossible, so it's impossible to do this for one change type. If you need to change two of the following optional attributes, we recommend separating them into two alterVolume
change types.
changeComment
Optional.
Specifies a new comment on the volume or removes the comment.
changeComment
has the following nested attributes:
comment
(string) (optional): overwrites an existing comment with the value you specify.unsetComment
(Boolean) (optional): iftrue
, removes a comment that has previously been specified.
changeOwner
Optional.
Specifies a new owner of the volume.
changeOwner
has the following nested attributes:
principal
(string) (required): the new principal to associate with the volume, such as the email address of an individual user.
renameVolume
Optional.
Renames the volume.
renameVolume
has the following nested attributes:
newName
(string) (required): the new name of the volume.
setTags
Optional.
Sets tags. You can use this to specify new tags or replace existing ones.
setTags
has the following nested attributes:
tags
(string) (required): the tags you want to specify. Specify tags using the format'key'='value'
. Separate multiple tags using commas.
unsetTags
Optional.
Removes previously specified tags.
unsetTags
has the following nested attributes:
tags
(string) (optional): the table properties you want to specify. Specify properties using the format'key'
. Separate multiple properties using commas.
Examples
databaseChangeLog:
- changeSet:
id: 2
author: your.name
changes:
- alterVolume:
volumeName: test_volume
changeComment:
comment: test_comment
rollback:
- alterVolume:
volumeName: test_volume
changeComment:
unsetComment: true
- changeSet:
id: 3
author: your.name
changes:
- alterVolume:
volumeName: test_volume
changeComment:
unsetComment: true
rollback:
empty
- changeSet:
id: 4
author: your.name
changes:
- alterVolume:
volumeName: test_volume
changeOwner:
principal: "principal.name@email.com"
rollback:
empty
- changeSet:
id: 5
author: your.name
changes:
- alterVolume:
volumeName: test_volume
renameVolume:
newName: test_volume_new
rollback:
- alterVolume:
volumeName: test_volume_new
renameVolume:
newName: test_volume
- changeSet:
id: 6
author: your.name
changes:
- alterVolume:
volumeName: test_volume
setTags:
tags: "'tag1'='val1', 'tag2'='val2', 'tag3'='val3'"
rollback:
empty
- changeSet:
id: 7
author:
changes:
- alterVolume:
volumeName: test_volume
unsetTags:
tags: "'tag1', 'tag2', 'tag3'"
rollback:
empty
{
"databaseChangeLog": [
{
"changeSet": {
"id": "2",
"author": "your.name",
"changes": [
{
"alterVolume": {
"volumeName": "test_volume",
"changeComment": {
"comment": "test_volume"
}
}
}
],
"rollback": [
{
"alterVolume": {
"volumeName": "test_volume",
"changeComment": {
"unsetComment": "true"
}
}
}
]
}
},
{
"changeSet": {
"id": "3",
"author": "your.name",
"changes": [
{
"alterVolume": {
"volumeName": "test_volume",
"changeComment": {
"unsetComment": "true"
}
}
}
],
"rollback": [
{
"empty": {
}
}
]
}
},
{
"changeSet": {
"id": "4",
"author": "your.name",
"changes": [
{
"alterVolume": {
"volumeName": "test_volume",
"changeOwner": {
"principal": "principal.name@email.com"
}
}
}
],
"rollback": [
{
"empty": {
}
}
]
}
},
{
"changeSet": {
"id": "5",
"author": "your.name",
"changes": [
{
"alterVolume": {
"volumeName": "test_volume",
"renameVolume": {
"newName": "test_volume_new"
}
}
}
],
"rollback": [
{
"alterVolume": {
"volumeName": "test_volume_new",
"renameVolume": {
"newName": "true"
}
}
}
]
}
},
{
"changeSet": {
"id": "6",
"author": "your.name",
"changes": [
{
"alterVolume": {
"volumeName": "test_volume",
"setTags": {
"tags": "'tag1'='val1', 'tag2'='val2', 'tag3'='val3'"
}
}
}
],
"rollback": [
{
"empty": {
}
}
]
}
},
{
"changeSet": {
"id": "7",
"author": "your.name",
"changes": [
{
"alterVolume": {
"volumeName": "test_volume",
"unsetTags": {
"tags": "'tag1', 'tag2', 'tag3'"
}
}
}
],
"rollback": [
{
"empty": {
}
}
]
}
}
]
}
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:databricks="http://www.liquibase.org/xml/ns/databricks"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/databricks
http://www.liquibase.org/xml/ns/databricks/liquibase-databricks-latest.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
<changeSet id="2" author="your.name">
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:changeComment comment="test_comment"/>
</pro-databricks:alterVolume>
<rollback>
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:changeComment unsetComment="true"/>
</pro-databricks:alterVolume>
</rollback>
</changeSet>
<changeSet id="3" author="your.name">
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:changeComment unsetComment="true"/>
</pro-databricks:alterVolume>
<rollback/>
</changeSet>
<changeSet id="4" author="your.name">
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:changeOwner principal="principal.name@email.com"/>
</pro-databricks:alterVolume>
<rollback/>
</changeSet>
<changeSet id="5" author="your.name">
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:renameVolume newName="test_volume_new"/>
</pro-databricks:alterVolume>
<rollback>
<pro-databricks:alterVolume volumeName="test_volume_new">
<pro-databricks:renameVolume newName="test_volume"/>
</pro-databricks:alterVolume>
</rollback>
</changeSet>
<changeSet id="6" author="your.name">
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:setTags tags="'tag1'='val1', 'tag2'='val2', 'tag3'='val3'"/>
</pro-databricks:alterVolume>
<rollback/>
</changeSet>
<changeSet id="7" author="your.name">
<pro-databricks:alterVolume volumeName="test_volume">
<pro-databricks:unsetTags tags="'tag1', 'tag2', 'tag3'"/>
</pro-databricks:alterVolume>
<rollback/>
</changeSet>
</databaseChangeLog>
Database support
This Change Type is only supported for Databricks. It does not support auto rollback.