createDatabase

Creates a new database in Snowflake. Supports creating standard databases, transient databases, and replica databases from primary databases in other accounts.

Note: Automatic rollback drops the database.

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

databaseName

String

Name of the database to create

Yes

replaceIfExists

Boolean

Replace the database if it already exists using OR REPLACE

No

ifNotExists

Boolean

Only create the database if it doesn't exist using IF NOT EXISTS*

No

comment

String

Comment describing the database

No

standardDatabase

Nested

Configuration for standard/transient database

No*

replicaDatabase

Nested

Configuration for replica database

No*

* replaceIfExists and ifNotExists are mutually exclusive. Exactly one of standardDatabase or replicaDatabase must be specified.

standardDatabase attributes

Attribute

Type

Description

Required

isTransient

Boolean

Create a transient database

No

dataRetentionTimeInDays

Integer

Days to retain data for Time Travel (0-90)

No

maxDataExtensionTimeInDays

Integer

Maximum days Time Travel retention can be extended

No

defaultDdlCollation

String

Default collation for objects in the database

No

storageSerializationPolicy

String

Storage format policy (COMPATIBLE or OPTIMIZED)

No

externalVolume

String

External volume for Iceberg tables

No

catalog

String

Catalog integration for Iceberg tables

No

replaceInvalidCharacters

String

Replace invalid UTF-8 characters in Iceberg tables

No

tags

Nested

Key-value pairs of tags to apply

No

contacts

Nested

Key-value pairs mapping contact purposes to names

No

standardDatabase nested elements

tags - Key-value pairs of tags to apply:

Attribute

Type

Description

Required

key

String

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

Yes

value

String

Tag value

Yes

Contacts - Key-value pairs mapping contact purposes to contact names:

Attribute

Type

Description

Required

key

String

Contact purpose: `steward`, `support`, or `approver`

Yes

value

String

Name of existing contact object (simple, schema, or fully qualified)

Yes

replicaDatabase attributes

Attribute

Type

Description

Required

primaryAccount

String

Account identifier of the primary database

Yes

primaryDatabase

String

Name of the primary database to replicate

Yes

dataRetentionTimeInDays

Integer

Days to retain data for Time Travel

No

maxDataExtensionTimeInDays

Integer

Maximum days Time Travel retention can be extended

No

<?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">
  <!-- Standard database with full configuration -->
  <changeSet id="create-standard-database" author="examples">
    <pro-snowflake:createDatabase
            databaseName="MY_DATABASE"
            comment="Standard database with full configuration"
            ifNotExists="true">
      <pro-snowflake:standardDatabase
                dataRetentionTimeInDays="7"
                maxDataExtensionTimeInDays="14"
                defaultDdlCollation="en_US"
                storageSerializationPolicy="COMPATIBLE">
        <pro-snowflake:tags>
          <pro-snowflake:entry key="PUBLIC.environment" value="production"/>
        </pro-snowflake:tags>
      </pro-snowflake:standardDatabase>
    </pro-snowflake:createDatabase>
  </changeSet>
  <!-- Transient database -->
  <changeSet id="create-transient-database" author="examples">
    <pro-snowflake:createDatabase
            databaseName="TEMP_DATABASE"
            comment="Transient database for temporary data">
      <pro-snowflake:standardDatabase
                isTransient="true"
                dataRetentionTimeInDays="1"/>
    </pro-snowflake:createDatabase>
  </changeSet>
  <!-- Replica database -->
  <changeSet id="create-replica-database" author="examples">
    <pro-snowflake:createDatabase
            databaseName="REPLICA_DATABASE"
            comment="Replica of primary database">
      <pro-snowflake:replicaDatabase
                primaryAccount="MYORG.PRIMARY_ACCOUNT"
                primaryDatabase="PRIMARY_DB"
                dataRetentionTimeInDays="2"/>
    </pro-snowflake:createDatabase>
  </changeSet>
</databaseChangeLog>