alterDatabaseTags

Sets or unsets tags on an existing Snowflake database. Tags are key-value pairs used for object categorization, governance, and cost tracking.

Note: This change type does not support automatic rollback or database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

databaseName

String

Name of the database to alter tags on

Yes

ifExists

Boolean

Only alter if the database exists using IF EXISTS

No

setTags

Nested

Key-value pairs of tags to set*

No

unsetTags

Nested

List of tag names to remove*

No

*Exactly one of setTags or unsetTags must be specified.

setTags attributes

Attribute

Type

Description

Required

key

String

Tag name (simple, schema-qualified, or fully-qualified)

Yes

value

String

Tag value

Yes

unsetTags attributes

Attribute

Type

Description

Required

tagName

String

Tag name to remove (simple, schema-qualified, or fully-qualified)

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">
  <!-- Set single tag -->
  <changeSet id="alter-database-set-tag" author="examples">
    <pro-snowflake:alterDatabaseTags
            databaseName="MY_DATABASE"
            ifExists="true">
      <pro-snowflake:setTags>
        <pro-snowflake:entry key="PUBLIC.environment" value="production"/>
      </pro-snowflake:setTags>
    </pro-snowflake:alterDatabaseTags>
  </changeSet>
  <!-- Set multiple tags -->
  <changeSet id="alter-database-set-tags" author="examples">
    <pro-snowflake:alterDatabaseTags databaseName="MY_DATABASE">
      <pro-snowflake:setTags>
        <pro-snowflake:entry key="PUBLIC.cost_center" value="engineering"/>
        <pro-snowflake:entry key="PUBLIC.owner" value="team_alpha"/>
        <pro-snowflake:entry key="PUBLIC.criticality" value="high"/>
      </pro-snowflake:setTags>
    </pro-snowflake:alterDatabaseTags>
  </changeSet>
  <!-- Unset single tag -->
  <changeSet id="alter-database-unset-tag" author="examples">
    <pro-snowflake:alterDatabaseTags databaseName="MY_DATABASE">
      <pro-snowflake:unsetTags>
        <pro-snowflake:unsetTag tagName="PUBLIC.criticality"/>
      </pro-snowflake:unsetTags>
    </pro-snowflake:alterDatabaseTags>
  </changeSet>
  <!-- Unset multiple tags -->
  <changeSet id="alter-database-unset-tags" author="examples">
    <pro-snowflake:alterDatabaseTags databaseName="MY_DATABASE">
      <pro-snowflake:unsetTags>
        <pro-snowflake:unsetTag tagName="PUBLIC.environment"/>
        <pro-snowflake:unsetTag tagName="PUBLIC.owner"/>
      </pro-snowflake:unsetTags>
    </pro-snowflake:alterDatabaseTags>
  </changeSet>
</databaseChangeLog>