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 |
|---|---|---|---|
| String | Name of the new cloned database | Yes |
| String | Name of the source database to clone | Yes |
| Boolean | Replace the database if it already exists using | No |
| Boolean | Only create the database if it doesn't exist using | No |
| Boolean | Create a transient cloned database | No |
| Integer | Days to retain data for Time Travel (0-90) | No |
| Integer | Maximum days Time Travel retention can be extended | No |
| String | Default collation for objects in the database | No |
| String | Storage format policy ( | No |
| String | External volume for Iceberg tables | No |
| String | Catalog integration for Iceberg tables | No |
| Boolean | Replace invalid UTF-8 characters in Iceberg tables | No |
| Boolean | Ignore tables with insufficient data retention for Time Travel | No |
| Boolean | Ignore hybrid tables during cloning | No |
| String | Comment describing the database | No |
| Nested | Time travel options for cloning from historical state | No |
| Nested | Key-value pairs mapping contact purposes to contact names | No |
* replaceIfExists and ifNotExists are mutually exclusive
timeTravelClause attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Type of Time Travel ( | Yes |
| String | Timestamp for AT/BEFORE clause (supports SQL expressions)* | No |
| String | Offset in seconds for Time Travel (e.g., | No |
| 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 |
|---|---|---|---|
| String | Contact purpose: | Yes |
| 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>