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 on 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:
- 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
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 values 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'='value'
. Separate multiple values using commas.
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'"
{
"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",
"unsetExtendedTableProperties": {
"tblProperties": "'external.location', 'this.is.my.key','this.is.my.key2'"
}
}
}
]
}
}
]
}
<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">
<databricks:alterTableProperties tableName="test_alter_table_properties">
<databricks:setExtendedTableProperties tblProperties="'external.location'='s3://mybucket/mytable','this.is.my.key'=12,'this.is.my.key2'=true"/>
</databricks:alterTableProperties>
<rollback>
<databricks:alterTableProperties tableName="test_alter_table_properties">
<databricks:unsetExtendedTableProperties tblProperties="'external.location', 'this.is.my.key','this.is.my.key2'"/>
</databricks:alterTableProperties>
</rollback>
</changeSet>
</databaseChangeLog>
Database support
This Change Type is only supported for Databricks. It does not support auto rollback.