Skip to main content
This can be used to create materialized views and sinks. See the practice in Sink data with upsert in Snowflake. The AS CHANGELOG clause adds two metadata columns:
  • changelog_op: the change type (1 = Insert, 2 = Delete, 3 = UpdateInsert, 4 = UpdateDelete)
  • _changelog_row_id: a monotonically increasing identifier that captures the order of the change.

Syntax

This is done using the CTE syntax. It converts the source_table change record to a column of table_name.

Example

Create MV
Changelog operation
Query MV