alterDynamicTableColumn

Modifies column properties on an existing Snowflake dynamic table.

Note: Dynamic table columns are derived from the query, so they have fewer modifiable properties compared to standard table columns. They don't support data type changes, nullable changes, default values, auto-increment, or computed columns.

Note: This change type does not support automatic rollback.

Available attributes

Attribute

Type

Description

Required

catalogName

String

Name of the catalog (database) containing the dynamic table

No

schemaName

String

Name of the schema containing the dynamic table

No

tableName

String

Name of the dynamic table containing the column

Yes

columnName

String

Name of the column to alter

Yes

ifExists

Boolean

Only execute if the dynamic table exists

No

Masking policy

Sets or unsets a masking policy on the column.

alterMaskingPolicy nested attributes

Attribute

Type

Description

Required

policyName

String

Name of the masking policy to apply

No*

using

String

Additional columns for conditional masking

No

force

Boolean

If true, forces policy replacement

No

unsetPolicy

Boolean

If true, removes the masking policy

No*

*Specify either policyName to set or unsetPolicy to remove.

<?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">
  <!-- Set masking policy -->
  <changeSet id="set-masking-policy" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="EMAIL">
      <pro-snowflake:alterMaskingPolicy policyName="EMAIL_MASK" force="true"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
  <!-- Set masking policy with conditional columns -->
  <changeSet id="set-masking-policy-conditional" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="SSN">
      <pro-snowflake:alterMaskingPolicy
                policyName="SSN_MASK"
                using="ROLE_COLUMN"
                force="true"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
  <!-- Unset masking policy -->
  <changeSet id="unset-masking-policy" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="EMAIL">
      <pro-snowflake:alterMaskingPolicy unsetPolicy="true"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
</databaseChangeLog>

Projection policy

Sets or unsets a projection policy on the column.

alterProjectionPolicy nested attributes

Attribute

Type

Description

Required

policyName

String

Name of the projection policy

No*

force

Boolean

If true, forces policy replacement

No

unsetPolicy

Boolean

If true, removes the projection policy

No*

*Specify either policyName to set or unsetPolicy to remove.

<?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">
  <!-- Set projection policy -->
  <changeSet id="set-projection-policy" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="SECRET_COLUMN">
      <pro-snowflake:alterProjectionPolicy policyName="NO_PROJECTION" force="true"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
  <!-- Unset projection policy -->
  <changeSet id="unset-projection-policy" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="SECRET_COLUMN">
      <pro-snowflake:alterProjectionPolicy unsetPolicy="true"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
</databaseChangeLog>

Comment

Sets or unsets the column comment.

alterColumnComment nested attributes

Attribute

Type

Description

Required

newComment

String

New comment text

No*

unsetComment

Boolean

If true, removes the comment

No*

*Exactly one of newComment or unsetComment must be specified.

<?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">
  <!-- Set column comment -->
  <changeSet id="set-column-comment" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="MY_COLUMN">
      <pro-snowflake:alterColumnComment newComment="Aggregated customer data"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
  <!-- Remove column comment -->
  <changeSet id="unset-column-comment" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="MY_COLUMN">
      <pro-snowflake:alterColumnComment unsetComment="true"/>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
</databaseChangeLog>

Tags

Sets or unsets tags on the column.

alterColumnTags nested attributes

Attribute

Type

Description

Required

setTags

Object

Map of tag names to values to set

No*

unsetTags

Object

List of tag names to unset

No*

*Exactly one of setTags or unsetTags must be specified.

<?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">
  <!-- Set column tags -->
  <changeSet id="set-column-tags" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="AGGREGATED_DATA">
      <pro-snowflake:alterColumnTags>
        <pro-snowflake:setTags>
          <pro-snowflake:entry key="PII" value="false"/>
          <pro-snowflake:entry key="DATA_TYPE" value="AGGREGATE"/>
        </pro-snowflake:setTags>
      </pro-snowflake:alterColumnTags>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
  <!-- Unset column tags -->
  <changeSet id="unset-column-tags" author="examples">
    <pro-snowflake:alterDynamicTableColumn tableName="MY_DYNAMIC_TABLE" columnName="AGGREGATED_DATA">
      <pro-snowflake:alterColumnTags>
        <pro-snowflake:unsetTags>
          <pro-snowflake:unsetTag tagName="PII"/>
          <pro-snowflake:unsetTag tagName="DATA_TYPE"/>
        </pro-snowflake:unsetTags>
      </pro-snowflake:alterColumnTags>
    </pro-snowflake:alterDynamicTableColumn>
  </changeSet>
</databaseChangeLog>