alterTableProperties

alterTableProperties is a Change Type in the Liquibase Open Source Databricks extension that alters the properties of a table.

Uses

You can use this Change Type to modify the properties of an existing table. For example, if you created a new table using the Liquibase createTable Change Type, you may have used the Liquibase Databricks extension extendedTableProperties tag to specify some additional properties in the table. If you want to change these properties, you can do so with alterTableProperties.

Note: You can only use alterTableProperties to modify the Databricks key-value pairs specified in extendedTableProperties. To modify other features of the table, use the appropriate Liquibase Change Type, such as renameTable.

Run alterTableProperties

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

Tip: You must specify all top-level attributes marked as required. If you specify an optional attribute, you must also specify any nested attributes that it requires.

Name

Type

Description

Requirement

tableName

String

Name of the table to alter table properties on.

Required

setExtendedTableProperties (optional)

Specifies additional properties. You can use this to specify new properties or replace existing ones. setExtendedTableProperties has the following nested attributes: tblProperties (string) (required): The table properties you want to specify. Specify properties using the format 'key'='value'. Separate multiple properties using commas.

unsetExtendedTableProperties (optional)

Removes additional properties that have previously been specified. unsetExtendedTableProperties has the following nested attributes: tblProperties (string) (required): The table properties you want to specify. Specify properties using the format 'key'. Separate multiple keys using commas.

alterTableProperties examples

databaseChangeLog:
  - changeSet:
      id: 2
      author: your.name
      changes:
        - alterTableProperties:
            tableName: test_alter_table_properties
            setExtendedTableProperties:
              tblProperties: '''external.location''=''s3://mybucket/mytable'',''this.is.my.key''=12,''this.is.my.key2''=true'
      rollback:
        - alterTableProperties:
            tableName: test_alter_table_properties
            unsetExtendedTablePropeties:
              tblProperties: '''external.location'', ''this.is.my.key'',''this.is.my.key2'''