createTable with dynamicTable

Creates a dynamic table in Snowflake. Dynamic tables are materialized views that automatically refresh based on changes to underlying data. This extends core Liquibase's createTable change type with dynamic table-specific features.

Note: Automatic rollback drops the table.

Known limitation: 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

catalogName

String

Name of the catalog (database)

No

schemaName

String

Name of the schema

No

tableName

String

Name of the dynamic table to create

Yes

remarks

String

Comment describing the table

No

targetLag

String

Refresh lag (e.g., 5 minutes, 1 hour, DOWNSTREAM)

Yes

warehouse

String

Warehouse name for refresh operations

Yes

query

String

The AS SELECT query defining the table

Yes

replaceIfExists

Boolean

If true, replaces the existing with OR REPLACE*

No

ifNotExists

Boolean

If true, only creates if the table doesn't exist*

No

isTransient

Boolean

If true, creates a transient dynamic table

No

refreshMode

String

Refresh mode: AUTO, FULL, or INCREMENTAL

No

initialize

String

Initialization mode: ON_CREATE or ON_SCHEDULE

No

clusterBy

String

Comma-separated list of columns for clustering

No

dataRetentionTimeInDays

Integer

Time Travel retention period (0-90 days)

No

maxDataExtensionTimeInDays

Integer

Maximum extension beyond retention period

No

copyGrants

Boolean

If true, copies grants from existing table**

No

requireUser

Boolean

If true, requires user context for refresh***

No

immutableWhere

String

Immutable WHERE clause for the query

No

backfillFrom

String

Source table for backfilling data****

No

*replaceIfExists and ifNotExists are mutually exclusive.

**copyGrants requires replaceIfExists=true.

***Cannot use requireUser=truewith initialize=ON_CREATE.

****Cannot specify tagswhen using backfillFrom.

Nested elements

Element

Type

Description

columnDynamicTable

Column definition

Column with Snowflake-specific properties (optional)

tags

MapWrapper

Key-value pairs of tags to apply

rowAccessPolicy

RowAccessPolicy

Row-level security policy

aggregationPolicy

AggregationPolicy

Privacy-preserving aggregation policy

columnDynamicTable attributes

Optional element to define columns with Snowflake-specific properties like masking policies and collation.

Attribute

Type

Description

name

String

Column name

type

String

Snowflake data type

nullable

Boolean

Whether column allows NULL

collation

String

Column collation (e.g., en-ci)

maskingPolicy

String

Name of masking policy to apply

remarks

String

Column comment

loading