event_tables
Creates, updates, deletes, gets or lists a event_tables
resource.
Overview
Name | event_tables |
Type | Resource |
Id | snowflake.event_table.event_tables |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Name of the event table |
automatic_clustering | boolean | If Automatic Clustering is enabled for your account, specifies whether it is explicitly enabled or disabled for the table. |
bytes | integer | 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 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 |
database_name | string | Database in which the event table is stored |
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 | Number of rows in the table. |
schema_name | string | Schema in which the event table is stored |
search_optimization | boolean | If ON, the table has the search optimization service enabled |
search_optimization_bytes | integer | Number of additional bytes of storage that the search optimization service consumes for this table |
search_optimization_progress | integer | Percentage of the table that has been optimized for search |
Methods
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
fetch_event_table | SELECT | database_name, name, schema_name, endpoint | - | Fetch an event table |
list_event_tables | SELECT | database_name, schema_name, endpoint | like , startsWith , showLimit , fromName | List event tables |
create_event_table | INSERT | database_name, schema_name, data__name, endpoint | createMode , copyGrants | Create an event table |
delete_event_table | DELETE | database_name, name, schema_name, endpoint | ifExists | Delete an event table |
rename_event_table | EXEC | database_name, name, schema_name, targetName, endpoint | ifExists | Rename the event table |
Expand this to view optional parameter details for all methods in this resource.
Optional Parameter Details
Name | Description | Type | Default |
---|---|---|---|
copyGrants | Query parameter to enable copy grants when creating the object. | boolean | false |
createMode | 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. | string | errorIfExists |
fromName | 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. | string | - |
ifExists | 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. | boolean | false |
like | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. | string | - |
showLimit | Query parameter to limit the maximum number of rows returned by a command. | integer | - |
startsWith | 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. | 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.
- Required Properties
- All Properties
- Manifest
/*+ 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 }}'
;
/*+ create */
INSERT INTO snowflake.event_table.event_tables (
data__name,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
- name: event_tables
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__name
value: string
- name: endpoint
value: string
- name: name
value: string
- name: cluster_by
value: array
- name: data_retention_time_in_days
value: integer
- name: max_data_extension_time_in_days
value: integer
- name: change_tracking
value: boolean
- name: default_ddl_collation
value: string
- name: comment
value: string
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 }}';