alterViewProperties

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

Uses

You can use this Change Type to modify the properties of an existing view. For example, if you created a new view using the createView Change Type, you can use alterViewProperties to alter the value of tblProperties you originally set.

Run alterViewProperties

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:
  4. 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
viewName String Name of the view to alter view 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:
        - alterViewProperties:
            viewName: test_alter_view_properties
            setExtendedTableProperties:
              tblProperties: "'external.location'='s3://mybucket/mytable','this.is.my.key'=12,'this.is.my.key2'=true"
      rollback:
        - alterViewProperties:
            viewName: test_alter_view_properties
            unsetExtendedTablePropeties:
              tblProperties: "'external.location', 'this.is.my.key','this.is.my.key2'"
{
  "databaseChangeLog": [
    {
      "changeSet": {
        "id": "2",
        "author": "your.name",
        "changes": [
          {
            "alterViewProperties": {
              "viewName": "test_alter_view_properties",
              "setExtendedTableProperties": {
                "tblProperties": "'external.location'='s3://mybucket/mytable','this.is.my.key'=12,'this.is.my.key2'=true"
              }
            }
          }
        ],
        "rollback": [
          {
            "alterViewProperties": {
              "viewName": "test_alter_view_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:alterViewProperties viewName="test_alter_view_properties">
            <databricks:setExtendedTableProperties tblProperties="'external.location'='s3://mybucket/mytable','this.is.my.key'=12,'this.is.my.key2'=true"/>
        </databricks:alterViewProperties>

        <rollback>
            <databricks:alterViewProperties viewName="test_alter_view_properties">
                <databricks:unsetExtendedTableProperties tblProperties="'external.location', 'this.is.my.key','this.is.my.key2'"/>
            </databricks:alterViewProperties>
        </rollback>
    </changeSet>

</databaseChangeLog>

Database support

This Change Type is only supported for Databricks. It does not support auto rollback.