Skip to main content

event_tables

Creates, updates, deletes, gets or lists a event_tables resource.

Overview

Nameevent_tables
TypeResource
Idsnowflake.event_table.event_tables

Fields

NameDatatypeDescription
namestringName of the event table
automatic_clusteringbooleanIf Automatic Clustering is enabled for your account, specifies whether it is explicitly enabled or disabled for the table.
bytesintegerNumber 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_trackingbooleanTrue if change tracking is enabled, allowing streams and CHANGES to be used on the entity.
cluster_byarrayCluster key column(s) or expression
columnsarray
commentstringuser comment associated to an object in the dictionary
created_onstringDate and time when the event table was created.
data_retention_time_in_daysintegernumber of days to retain the old version of deleted/updated data
database_namestringDatabase in which the event table is stored
default_ddl_collationstringCollation that is used for all the new columns created by the DDL statements (if not specified)
max_data_extension_time_in_daysintegerMaximum number of days to extend data retention beyond the retention period to prevent a stream becoming stale.
ownerstringRole that owns the event table
owner_role_typestringThe type of role that owns the event table
rowsintegerNumber of rows in the table.
schema_namestringSchema in which the event table is stored
search_optimizationbooleanIf ON, the table has the search optimization service enabled
search_optimization_bytesintegerNumber of additional bytes of storage that the search optimization service consumes for this table
search_optimization_progressintegerPercentage of the table that has been optimized for search

Methods

NameAccessible byRequired ParamsOptional ParamsDescription
fetch_event_tableSELECTdatabase_name, name, schema_name, endpoint-Fetch an event table
list_event_tablesSELECTdatabase_name, schema_name, endpointlike, startsWith, showLimit, fromNameList event tables
create_event_tableINSERTdatabase_name, schema_name, data__name, endpointcreateMode, copyGrantsCreate an event table
delete_event_tableDELETEdatabase_name, name, schema_name, endpointifExistsDelete an event table
rename_event_tableEXECdatabase_name, name, schema_name, targetName, endpointifExistsRename the event table

Expand this to view optional parameter details for all methods in this resource.
Optional Parameter Details
NameDescriptionTypeDefault
copyGrantsQuery parameter to enable copy grants when creating the object.booleanfalse
createModeQuery 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.stringerrorIfExists
fromNameQuery 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.string-
ifExistsQuery 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.booleanfalse
likeQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.string-
showLimitQuery parameter to limit the maximum number of rows returned by a command.integer-
startsWithQuery 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.string-

SELECT examples

List event tables

SELECT
name,
automatic_clustering,
bytes,
change_tracking,
cluster_by,
columns,
comment,
created_on,
data_retention_time_in_days,
database_name,
default_ddl_collation,
max_data_extension_time_in_days,
owner,
owner_role_type,
rows,
schema_name,
search_optimization,
search_optimization_bytes,
search_optimization_progress
FROM snowflake.event_table.event_tables
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 event_tables resource.

/*+ create */
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
)
SELECT
'{{ name }}',
'{{ cluster_by }}',
'{{ data_retention_time_in_days }}',
'{{ max_data_extension_time_in_days }}',
'{{ change_tracking }}',
'{{ default_ddl_collation }}',
'{{ comment }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;

DELETE example

Deletes the specified event_tables resource.

/*+ delete */
DELETE FROM snowflake.event_table.event_tables
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';