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:

  1. Add the Change Type to your changeset, as shown in the examples on this page.

  2. Specify any required attributes. Use the table on this page to see which ones your database requires.

  3. 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

It's not possible to modify two properties in a single alterVolume SQL statement, which means you can't make both changes within a single change type. If you need to update two of the optional attributes, we recommend using two separate 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): if true, 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.

alterVolume 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: null
      changes:
        - alterVolume:
            volumeName: test_volume
            unsetTags:
              tags: '''tag1'', ''tag2'', ''tag3'''
      rollback: empty