cloneSchema
Creates a zero-copy clone of a Snowflake schema with optional time travel support. Clones can be created from the current state or from a specific point in time within the retention window.
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 |
|---|---|---|---|
| String | Name of the database containing the source schema | No |
| String | Name of the schema to clone from | Yes |
| String | Name of the database for the cloned schema | No |
| String | Name of the new cloned schema | Yes |
| Boolean | Replace existing schema with | No |
| Boolean | Only create if target doesn't exist with | No |
| Boolean | Skip tables lacking historical data (time travel only)** | No |
| Boolean | Skip hybrid tables during clone (time travel only)** | No |
| Boolean | Include named internal stages and files (time travel only)** | No |
| Nested | Time travel options for cloning from historical state | No |
* replaceIfExists and ifNotExists are mutually exclusive.
** These options require a timeTravelClause to be specified.
timeTravelClause attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Either | Yes |
| String | Absolute timestamp or SQL expression (e.g., | No |
| String | Relative seconds (e.g., | No |
| String | Statement ID from query history*** | No |
*** Exactly one of timestamp, offset, or statement 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">
<!-- Basic clone (current state) -->
<changeSet id="clone-basic" author="examples">
<pro-snowflake:cloneSchema
sourceSchemaName="PRODUCTION"
targetSchemaName="PRODUCTION_COPY"/>
</changeSet>
<!-- Clone with IF NOT EXISTS and time travel offset -->
<changeSet id="clone-with-offset" author="examples">
<pro-snowflake:cloneSchema
sourceSchemaName="ANALYTICS"
targetSchemaName="ANALYTICS_BACKUP"
ifNotExists="true">
<pro-snowflake:timeTravelClause timeTravelType="BEFORE">
<pro-snowflake:offset>-3600</pro-snowflake:offset>
</pro-snowflake:timeTravelClause>
</pro-snowflake:cloneSchema>
</changeSet>
<!-- Clone with OR REPLACE and all options -->
<changeSet id="clone-full-options" author="examples">
<pro-snowflake:cloneSchema
sourceSchemaName="DATA_WAREHOUSE"
targetSchemaName="DATA_WAREHOUSE_CLONE"
replaceIfExists="true"
ignoreTablesWithInsufficientDataRetention="true"
ignoreHybridTables="true"
includeInternalStages="true">
<pro-snowflake:timeTravelClause timeTravelType="AT">
<pro-snowflake:timestamp>2025-01-15 09:30:00</pro-snowflake:timestamp>
</pro-snowflake:timeTravelClause>
</pro-snowflake:cloneSchema>
</changeSet>
<!-- Cross-database clone -->
<changeSet id="clone-cross-database" author="examples">
<pro-snowflake:cloneSchema
sourceCatalogName="PROD_DB"
sourceSchemaName="ANALYTICS"
targetCatalogName="DEV_DB"
targetSchemaName="ANALYTICS_DEV"/>
</changeSet>
</databaseChangeLog>