createStream
Creates a new stream in Snowflake. Streams track data manipulation language (DML) changes made to tables, views, and other objects, enabling change data capture (CDC) workflows.
Note: Automatic rollback drops the stream.
Known limitation: 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 catalog (database) where the stream will be created | No |
| String | Name of the schema where the stream will be created | No |
| String | Name of the stream to create | Yes |
| String | Name of the source object (table, view, stage, etc.) | Yes |
| String | Name of the catalog containing the source object | No |
| String | Name of the schema containing the source object | No |
| String | Comment describing the stream | No |
| Boolean | If true, copies grants from the source object | No |
| Boolean | If true, replaces the stream if it already exists using | No |
| Boolean | If true, only creates if the stream doesn't exist using | No |
| Nested | Key-value pairs of tags to apply | No |
*replaceIfExists and ifNotExists are mutually exclusive.
Stream type elements
Exactly one stream type must be specified:
Element | Description |
|---|---|
| For tracking changes to standard tables |
| For tracking changes to views |
| For tracking changes to external tables |
| For tracking directory table changes on stages |
| For tracking changes to dynamic tables |
| For tracking changes to event tables |
tableStream / viewStream nested attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| Boolean | If true, creates append-only stream | No |
| Boolean | If true, includes initial data in stream | No |
| Nested | Time travel specification | No |
externalTableStream nested attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| Boolean | If true, only tracks inserts | No |
| Nested | Time travel specification | No |
timeTravelClause nested attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String |
| Yes |
| String | Offset value (e.g., | No |
| String | Timestamp value* | No |
| String | Statement ID* | No |
| String | Stream name for reference* | No |
*Exactly one of offset, timestamp, statement, or stream 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">
<!-- Table stream with time travel -->
<changeSet id="create-table-stream" author="examples">
<pro-snowflake:createStream streamName="TABLE_STREAM"
sourceName="SOURCE_TABLE"
replaceIfExists="true"
copyGrants="true"
comment="Stream for tracking table changes">
<pro-snowflake:tableStream showInitialRows="true" appendOnly="true">
<pro-snowflake:timeTravelClause timeTravelType="AT">
<pro-snowflake:offset>-1</pro-snowflake:offset>
</pro-snowflake:timeTravelClause>
</pro-snowflake:tableStream>
<pro-snowflake:tags>
<pro-snowflake:entry key="MYDB.PUBLIC.environment" value="production"/>
</pro-snowflake:tags>
</pro-snowflake:createStream>
</changeSet>
<!-- View stream -->
<changeSet id="create-view-stream" author="examples">
<pro-snowflake:createStream streamName="VIEW_STREAM"
sourceName="SOURCE_VIEW"
ifNotExists="true">
<pro-snowflake:viewStream appendOnly="true"/>
</pro-snowflake:createStream>
</changeSet>
<!-- Stage stream -->
<changeSet id="create-stage-stream" author="examples">
<pro-snowflake:createStream streamName="STAGE_STREAM"
sourceName="DIRECTORY_STAGE"
comment="Stream for directory table">
<pro-snowflake:stageStream/>
</pro-snowflake:createStream>
</changeSet>
<!-- External table stream with tags -->
<changeSet id="create-external-table-stream" author="examples">
<pro-snowflake:createStream streamName="EXTERNAL_TABLE_STREAM"
sourceName="SOURCE_EXTERNAL_TABLE"
comment="External table stream">
<pro-snowflake:externalTableStream insertOnly="true"/>
<pro-snowflake:tags>
<pro-snowflake:entry key="MYDB.PUBLIC.environment" value="prod"/>
</pro-snowflake:tags>
</pro-snowflake:createStream>
</changeSet>
<!-- Dynamic table stream -->
<changeSet id="create-dynamic-table-stream" author="examples">
<pro-snowflake:createStream streamName="DYNAMIC_TABLE_STREAM"
sourceName="SOURCE_DYNAMIC_TABLE">
<pro-snowflake:dynamicTableStream/>
</pro-snowflake:createStream>
</changeSet>
<!-- Event table stream -->
<changeSet id="create-event-table-stream" author="examples">
<pro-snowflake:createStream streamName="EVENT_TABLE_STREAM"
sourceName="SOURCE_EVENT_TABLE">
<pro-snowflake:eventTableStream/>
</pro-snowflake:createStream>
</changeSet>
</databaseChangeLog>