event_tables
Creates, updates, deletes, gets or lists an event_tables
resource.
Overview
Name | event_tables |
Type | Resource |
Id | snowflake.event_table.event_tables |
Fields
The following fields are returned by SELECT
queries:
- list_event_tables
- fetch_event_table
A Snowflake event table
Name | Datatype | Description |
---|---|---|
name | string | Name of the event table |
database_name | string | Database in which the event table is stored |
schema_name | string | Schema in which the event table is stored |
automatic_clustering | boolean | If Automatic Clustering is enabled for your account, specifies whether it is explicitly enabled or disabled for the table. |
bytes | integer (int64) | Number of bytes that will be scanned if the entire table is scanned in a query.Note that this number may be different than the number of actual physical bytes stored on-disk for the table |
change_tracking | boolean | True if change tracking is enabled, allowing streams and CHANGES to be used on the entity. |
cluster_by | array | Cluster key column(s) or expression |
columns | array | |
comment | string | user comment associated to an object in the dictionary |
created_on | string (date-time) | Date and time when the event table was created. |
data_retention_time_in_days | integer | number of days to retain the old version of deleted/updated data |
default_ddl_collation | string | Collation that is used for all the new columns created by the DDL statements (if not specified) |
max_data_extension_time_in_days | integer | Maximum number of days to extend data retention beyond the retention period to prevent a stream becoming stale. |
owner | string | Role that owns the event table |
owner_role_type | string | The type of role that owns the event table |
rows | integer (int64) | Number of rows in the table. |
search_optimization | boolean | If ON, the table has the search optimization service enabled |
search_optimization_bytes | integer (int64) | Number of additional bytes of storage that the search optimization service consumes for this table |
search_optimization_progress | integer (int64) | Percentage of the table that has been optimized for search |
A Snowflake event table
Name | Datatype | Description |
---|---|---|
name | string | Name of the event table |
database_name | string | Database in which the event table is stored |
schema_name | string | Schema in which the event table is stored |
automatic_clustering | boolean | If Automatic Clustering is enabled for your account, specifies whether it is explicitly enabled or disabled for the table. |
bytes | integer (int64) | Number of bytes that will be scanned if the entire table is scanned in a query.Note that this number may be different than the number of actual physical bytes stored on-disk for the table |
change_tracking | boolean | True if change tracking is enabled, allowing streams and CHANGES to be used on the entity. |
cluster_by | array | Cluster key column(s) or expression |
columns | array | |
comment | string | user comment associated to an object in the dictionary |
created_on | string (date-time) | Date and time when the event table was created. |
data_retention_time_in_days | integer | number of days to retain the old version of deleted/updated data |
default_ddl_collation | string | Collation that is used for all the new columns created by the DDL statements (if not specified) |
max_data_extension_time_in_days | integer | Maximum number of days to extend data retention beyond the retention period to prevent a stream becoming stale. |
owner | string | Role that owns the event table |
owner_role_type | string | The type of role that owns the event table |
rows | integer (int64) | Number of rows in the table. |
search_optimization | boolean | If ON, the table has the search optimization service enabled |
search_optimization_bytes | integer (int64) | Number of additional bytes of storage that the search optimization service consumes for this table |
search_optimization_progress | integer (int64) | Percentage of the table that has been optimized for search |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
list_event_tables | select | database_name , schema_name , endpoint | like , startsWith , showLimit , fromName | List event tables |
fetch_event_table | select | database_name , schema_name , name , endpoint | Fetch an event table | |
create_event_table | insert | database_name , schema_name , endpoint | createMode , copyGrants | Create an event table |
delete_event_table | delete | database_name , schema_name , name , endpoint | ifExists | Delete an event table |
rename_event_table | exec | database_name , schema_name , name , targetName , endpoint | ifExists | Rename the event table |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
database_name | string | Identifier (i.e. name) for the database to which the resource belongs. You can use the /api/v2/databases GET request to get a list of available databases. |
endpoint | string | Organization and Account Name (default: orgid-acctid) |
name | string | Identifier (i.e. name) for the resource. |
schema_name | string | Identifier (i.e. name) for the schema to which the resource belongs. You can use the /api/v2/databases/{database}/schemas GET request to get a list of available schemas for the specified database. |
targetName | string | Specify the name of the target resource to be renamed to. |
copyGrants | boolean | Query parameter to enable copy grants when creating the object. |
createMode | string | Query parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists : Throws an error if you try to create a resource that already exists. - orReplace : Automatically replaces the existing resource with the current one. - ifNotExists : Creates a new resource when an alter is requested for a non-existent resource. |
fromName | string | Query parameter to enable fetching rows only following the first row whose object name matches the specified string. Case-sensitive and does not have to be the full name. |
ifExists | boolean | Query parameter that specifies how to handle the request for a resource that does not exist: - true : The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false : The endpoint throws an error if the resource doesn't exist. |
like | string | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. |
showLimit | integer | Query parameter to limit the maximum number of rows returned by a command. |
startsWith | string | Query parameter to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching. |
SELECT
examples
- list_event_tables
- fetch_event_table
List event tables
SELECT
name,
database_name,
schema_name,
automatic_clustering,
bytes,
change_tracking,
cluster_by,
columns,
comment,
created_on,
data_retention_time_in_days,
default_ddl_collation,
max_data_extension_time_in_days,
owner,
owner_role_type,
rows,
search_optimization,
search_optimization_bytes,
search_optimization_progress
FROM snowflake.event_table.event_tables
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND like = '{{ like }}'
AND startsWith = '{{ startsWith }}'
AND showLimit = '{{ showLimit }}'
AND fromName = '{{ fromName }}';
Fetch an event table
SELECT
name,
database_name,
schema_name,
automatic_clustering,
bytes,
change_tracking,
cluster_by,
columns,
comment,
created_on,
data_retention_time_in_days,
default_ddl_collation,
max_data_extension_time_in_days,
owner,
owner_role_type,
rows,
search_optimization,
search_optimization_bytes,
search_optimization_progress
FROM snowflake.event_table.event_tables
WHERE database_name = '{{ database_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required;
INSERT
examples
- create_event_table
- Manifest
Create an event table
INSERT INTO snowflake.event_table.event_tables (
data__name,
data__cluster_by,
data__data_retention_time_in_days,
data__max_data_extension_time_in_days,
data__change_tracking,
data__default_ddl_collation,
data__comment,
database_name,
schema_name,
endpoint,
createMode,
copyGrants
)
SELECT
'{{ name }}' --required,
'{{ cluster_by }}',
{{ data_retention_time_in_days }},
{{ max_data_extension_time_in_days }},
{{ change_tracking }},
'{{ default_ddl_collation }}',
'{{ comment }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}',
'{{ createMode }}',
'{{ copyGrants }}'
;
# Description fields are for documentation purposes
- name: event_tables
props:
- name: database_name
value: string
description: Required parameter for the event_tables resource.
- name: schema_name
value: string
description: Required parameter for the event_tables resource.
- name: endpoint
value: string
description: Required parameter for the event_tables resource.
- name: name
value: string
description: >
Name of the event table
- name: cluster_by
value: array
description: >
Cluster key column(s) or expression
- name: data_retention_time_in_days
value: integer
description: >
number of days to retain the old version of deleted/updated data
- name: max_data_extension_time_in_days
value: integer
description: >
Maximum number of days to extend data retention beyond the retention period to prevent a stream becoming stale.
- name: change_tracking
value: boolean
description: >
True if change tracking is enabled, allowing streams and CHANGES to be used on the entity.
- name: default_ddl_collation
value: string
description: >
Collation that is used for all the new columns created by the DDL statements (if not specified)
- name: comment
value: string
description: >
user comment associated to an object in the dictionary
- name: createMode
value: string
description: Query parameter allowing support for different modes of resource creation. Possible values include: - `errorIfExists`: Throws an error if you try to create a resource that already exists. - `orReplace`: Automatically replaces the existing resource with the current one. - `ifNotExists`: Creates a new resource when an alter is requested for a non-existent resource.
- name: copyGrants
value: boolean
description: Query parameter to enable copy grants when creating the object.
DELETE
examples
- delete_event_table
Delete an event table
DELETE FROM snowflake.event_table.event_tables
WHERE database_name = '{{ database_name }}' --required
AND schema_name = '{{ schema_name }}' --required
AND name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';
Lifecycle Methods
- rename_event_table
Rename the event table
EXEC snowflake.event_table.event_tables.rename_event_table
@database_name='{{ database_name }}' --required,
@schema_name='{{ schema_name }}' --required,
@name='{{ name }}' --required,
@targetName='{{ targetName }}' --required,
@endpoint='{{ endpoint }}' --required,
@ifExists={{ ifExists }};