Skip to main content

Stream

Configuration can be provided to Snowflake Object Lifecycle Engine for the following operation with Stream:

  • Manage Lifecycle of new and existing Stream
  • Manage Grants of Stream

Supported Parameters

The engine supports the parameters listed below.

  • APPEND_ONLY: Specifies whether this is an append-only stream. Append-only streams track row inserts only. Update and delete operations (including table truncates) are not recorded.
    • Configuration key: append_only
    • Data Type: Boolean
  • COMMENT: Specifies a comment for the stream.
    • Configuration key: comment
    • Data Type: String
  • ON_TABLE: The table whose changes are tracked by the stream.
    • Configuration key: on_table
    • Data Type: String/Object . See here for definition of ON_TABLE
  • INSERT_ONLY: Create an insert only stream type.
    • Configuration key: insert_only
    • Data Type: Boolean
  • SHOW_INITIAL_ROWS: Specifies whether to return all existing rows in the source table as row inserts the first time the stream is consumed.
    • Configuration key: show_initial_rows
    • Data Type: Boolean
  • MANAGE_MODE: Configures what properties to manage for the Stream.
    • Configuration key: manage_mode
    • Data Type: String
    • Possible Values:
      • none
      • grants
      • all(Default)
  • GRANTS: List of Privileges and Roles to which privileges are granted to on the current Stream.
    • Configuration key: grants
    • Data Type: Map

Table

In the on_table parameter of the stream, users can specify either just the name of the table(if the table belongs to the same schema and database as the external table), or the name of schema and database as well.

See Database-Level Object Reference section for more information

The on_table parameter supports the following parameters if explicitly provided:

  • TABLE: Name of the Table
    • REQUIRED
    • Configuration key: table
    • Data Type: String
  • SCHEMA: Name of the schema, in which the table exists
    • REQUIRED if table is present in another Database or another Schema than the current one
    • Configuration key: schema
    • Data Type: String
  • DATABASE: Name of the database, in which the table exists
    • REQUIRED if table is present in another Database than the current one
    • Configuration key: database
    • Data Type: String

Example

on_table:
table: TABLE_1
schema: SCHEMA_1
database: DATABASE_2

Basic syntax

databases:
<database-name>:
schemas:
<schema-name>:
streams:
<stream-name>:
<configuration-key>: <value>
grants:
<privilege>:
- <role-name>
- <role-name>

Supported Stream Grants to Roles

Following is the list of Privileges Grant to Roles that can be specified in the stream definition

  • ALL PRIVILEGES
  • SELECT
  • OWNERSHIP

Examples

databases:
SALES_RECORD:
schemas:
SALES:
streams:
STREAM_1:
append_only: false
comment: "test stream"
on_table:
table: TABLE_1
schema: SCHEMA_1
database: DATABASE_2
grants:
select:
- SYSADMIN
- ACCOUNTADMIN