renameMaterializedView

Renames an existing materialized view in Snowflake. Materialized views require Snowflake Enterprise Edition or higher.

Note: Automatic rollback renames the view back to original name.

Known limitation: This change type does not support database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

catalogName

String

Name of the catalog (database) containing the materialized view

No

schemaName

String

Name of the schema containing the materialized view

No

oldViewName

String

Current name of the materialized view

Yes

newViewName

String

New name for the materialized view

Yes

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:pro-snowflake="http://www.liquibase.org/xml/ns/pro-snowflake"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        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/pro-snowflake
        http://www.liquibase.org/xml/ns/pro-snowflake/liquibase-pro-snowflake-latest.xsd">
  <!-- Basic rename -->
  <changeSet id="rename-mv-basic" author="examples">
    <pro-snowflake:renameMaterializedView
                oldViewName="MV_SALES"
                newViewName="MV_SALES_V2"/>
  </changeSet>
  <!-- Rename with schema qualification -->
  <changeSet id="rename-mv-qualified" author="examples">
    <pro-snowflake:renameMaterializedView
                catalogName="MY_DATABASE"
                schemaName="ANALYTICS"
                oldViewName="MV_OLD_NAME"
                newViewName="MV_NEW_NAME"/>
  </changeSet>
</databaseChangeLog>