streams
Creates, updates, deletes, gets or lists a streams
resource.
Overview
Name | streams |
Type | Resource |
Id | snowflake.streams.streams |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Name of the stream |
comment | string | user comment associated to an object in the dictionary |
created_on | string | Date and time when the stream was created. |
database_name | string | Database in which the stream is stored |
invalid_reason | string | Reason why the stream cannot be queried successfully. This column supports future functionality. Currently, the only value returned is N/A. |
mode | string | Mode of the stream. Possible values include: APPEND_ONLY, INSERT_ONLY. For streams on tables, the column displays DEFAULT. |
owner | string | Role that owns the stream |
owner_role_type | string | The type of role that owns the stream |
schema_name | string | Schema in which the stream is stored |
stale | boolean | Specifies whether the stream is stale or not |
stale_after | string | Timestamp when the stream became stale or may become stale if not consumed. |
stream_source | object | |
table_name | string | Table name whose changes are tracked by the stream |
type | string | Type of the stream; currently DELTA only. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
fetch_stream | SELECT | database_name, name, schema_name, endpoint | Fetch a stream |
list_streams | SELECT | database_name, schema_name, endpoint | List streams |
create_stream | INSERT | database_name, schema_name, data__name, data__stream_source, endpoint | Create a stream |
delete_stream | DELETE | database_name, name, schema_name, endpoint | Delete a stream |
clone_stream | EXEC | database_name, name, schema_name, targetDatabase, targetSchema, data__name, endpoint | Clone a stream |
SELECT
examples
List streams
SELECT
name,
comment,
created_on,
database_name,
invalid_reason,
mode,
owner,
owner_role_type,
schema_name,
stale,
stale_after,
stream_source,
table_name,
type
FROM snowflake.streams.streams
WHERE database_name = '{{ database_name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
INSERT
example
Use the following StackQL query and manifest file to create a new streams
resource.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO snowflake.streams.streams (
data__name,
data__stream_source,
data__comment,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ stream_source }}',
'{{ comment }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
/*+ create */
INSERT INTO snowflake.streams.streams (
data__name,
data__stream_source,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ stream_source }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
- name: streams
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__name
value: string
- name: data__stream_source
value: string
- name: endpoint
value: string
- name: name
value: string
- name: stream_source
props:
- name: src_type
value: string
- name: name
value: string
- name: database_name
value: string
- name: schema_name
value: string
- name: comment
value: string
DELETE
example
Deletes the specified streams
resource.
/*+ delete */
DELETE FROM snowflake.streams.streams
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';