cloneDynamicTable

Creates a zero-copy clone of a Snowflake dynamic table with optional time travel support. Clones can be created from the current state or from a specific point in time within the retention window. targetLag and warehouse parameters are optional and inherit from source if omitted.

Known limitations:

  • This change type does not support automatic rollback.

  • Snowflake snapshots created with Liquibase Secure 5.1 are incompatible with earlier versions due to enhanced object type detection for TABLES and VIEWS. Regenerate all snapshots with 5.1 after upgrading to avoid false differences in diff and diff-changelog operations.

Available attributes

Attribute

Type

Description

Required

sourceCatalogName

String

Name of the catalog containing the source dynamic table

No

sourceSchemaName

String

Name of the schema containing the source dynamic table

No

sourceTableName

String

Name of the dynamic table to clone from

Yes

targetCatalogName

String

Name of the catalog for the cloned dynamic table

No

targetSchemaName

String

Name of the schema for the cloned dynamic table

No

targetTableName

String

Name of the new cloned dynamic table

Yes

replaceIfExists

Boolean

If true, replaces existing table with OR REPLACE*

No

ifNotExists

Boolean

If true, only creates if target doesn't exist*

No

copyGrants

Boolean

If true, copies grants from source table**

No

isTransient

Boolean

If true, creates a TRANSIENT dynamic table (no fail-safe)

No

targetLag

String

Target lag for refresh (e.g., 1 hour, DOWNSTREAM)

No

warehouse

String

Warehouse for refresh operations

No

timeTravelClause

Nested

Time travel options for cloning from historical state

No

*replaceIfExists and ifNotExists are mutually exclusive.

**copyGrants requires replaceIfExists=true.

timeTravelClause nested attributes

Attribute

Type

Description

Required

timeTravelType

String

Either AT or BEFORE

Yes

offset

String

Relative seconds (e.g., -3600 for 1 hour ago)***

No

statement

String

DML statement ID from query history***

No

***Exactly one of offset or statement must be specified. Note: timestamp time travel is documented by Snowflake but currently broken for dynamic tables.

<?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">
  <!-- Simple clone (inherits targetLag and warehouse from source) -->
  <changeSet id="clone-simple" author="examples">
    <pro-snowflake:cloneDynamicTable
            sourceTableName="source_dynamic_table"
            targetTableName="cloned_dynamic_simple"/>
  </changeSet>
  <!-- Clone with explicit targetLag and warehouse -->
  <changeSet id="clone-with-params" author="examples">
    <pro-snowflake:cloneDynamicTable
            sourceTableName="source_dynamic_table"
            targetTableName="cloned_dynamic_custom"
            targetLag="2 hours"
            warehouse="RD_WH"
            ifNotExists="true"/>
  </changeSet>
  <!-- Clone with time travel OFFSET -->
  <changeSet id="clone-with-offset" author="examples">
    <pro-snowflake:cloneDynamicTable
            sourceTableName="source_dynamic_table"
            targetTableName="cloned_dynamic_offset">
      <pro-snowflake:timeTravelClause timeTravelType="BEFORE">
        <pro-snowflake:offset>-300</pro-snowflake:offset>
      </pro-snowflake:timeTravelClause>
    </pro-snowflake:cloneDynamicTable>
  </changeSet>
  <!-- Clone with OR REPLACE, COPY GRANTS, and TRANSIENT -->
  <changeSet id="clone-full-featured" author="examples">
    <pro-snowflake:cloneDynamicTable
            sourceTableName="source_dynamic_table"
            targetTableName="cloned_dynamic_full"
            replaceIfExists="true"
            copyGrants="true"
            isTransient="true"
            targetLag="DOWNSTREAM"
            warehouse="RD_WH"/>
  </changeSet>
</databaseChangeLog>