cloneDatabase

Creates a clone of an existing database in Snowflake with support for Time Travel, transient clones, and comprehensive configuration options.

Note: 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 new cloned database

Yes

sourceDatabase

String

Name of the source database to clone

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

isTransient

Boolean

Create a transient cloned 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

Boolean

Replace invalid UTF-8 characters in Iceberg tables

No

ignoreTablesWithInsufficientDataRetention

Boolean

Ignore tables with insufficient data retention for Time Travel

No

ignoreHybridTables

Boolean

Ignore hybrid tables during cloning

No

comment

String

Comment describing the database

No

timeTravelClause

Nested

Time travel options for cloning from historical state

No

contacts

Nested

Key-value pairs mapping contact purposes to contact names

No

* replaceIfExists and ifNotExists are mutually exclusive

timeTravelClause attributes

Attribute

Type

Description

Required

timeTravelType

String

Type of Time Travel (AT or BEFORE)

Yes

timestamp

String

Timestamp for AT/BEFORE clause (supports SQL expressions)*

No

offset

String

Offset in seconds for Time Travel (e.g., -1)*

No

statement

String

Query ID or statement reference for Time Travel*

No

* Exactly one of timestamp, offset, or statement must be specified

contacts attributes

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

<?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 clone -->
  <changeSet id="clone-database-basic" author="examples">
    <pro-snowflake:cloneDatabase
                databaseName="CLONE_DB"
                sourceDatabase="SOURCE_DB"
                ifNotExists="true"/>
  </changeSet>
  <!-- Clone with Time Travel AT TIMESTAMP -->
  <changeSet id="clone-database-timestamp" author="examples">
    <pro-snowflake:cloneDatabase
                databaseName="CLONE_DB_TIMESTAMP"
                sourceDatabase="SOURCE_DB">
      <pro-snowflake:timeTravelClause timeTravelType="AT">
        <pro-snowflake:timestamp>DATEADD(seconds, -60, current_timestamp)::TIMESTAMP_TZ</pro-snowflake:timestamp>
      </pro-snowflake:timeTravelClause>
    </pro-snowflake:cloneDatabase>
  </changeSet>
  <!-- Clone with Time Travel BEFORE OFFSET -->
  <changeSet id="clone-database-offset" author="examples">
    <pro-snowflake:cloneDatabase
                databaseName="CLONE_DB_OFFSET"
                sourceDatabase="SOURCE_DB"
                ignoreTablesWithInsufficientDataRetention="true">
      <pro-snowflake:timeTravelClause timeTravelType="BEFORE">
        <pro-snowflake:offset>-1</pro-snowflake:offset>
      </pro-snowflake:timeTravelClause>
    </pro-snowflake:cloneDatabase>
  </changeSet>
  <!-- Transient clone with full configuration -->
  <changeSet id="clone-database-full" author="examples">
    <pro-snowflake:cloneDatabase
                databaseName="CLONE_DB_FULL"
                sourceDatabase="SOURCE_DB"
                replaceIfExists="true"
                isTransient="true"
                dataRetentionTimeInDays="5"
                maxDataExtensionTimeInDays="10"
                defaultDdlCollation="en_US"
                storageSerializationPolicy="OPTIMIZED"
                ignoreHybridTables="true"
                comment="Transient clone with full configuration">
      <pro-snowflake:contacts>
        <pro-snowflake:entry key="steward" value="db_steward"/>
        <pro-snowflake:entry key="support" value="db_support"/>
      </pro-snowflake:contacts>
    </pro-snowflake:cloneDatabase>
  </changeSet>
</databaseChangeLog>