snowflake.core.event_table.EventTableCollectionΒΆ

class snowflake.core.event_table.EventTableCollection(schema: SchemaResource)ΒΆ

Bases: SchemaObjectCollectionParent[EventTableResource]

Represents the collection operations on the Snowflake Event Table resource.

With this collection, you can create, iterate through, and fetch event tables that you have access to in the current context.

Initialize collection for Event Table.

Attributes

databaseΒΆ
rootΒΆ

Methods

create(event_table: EventTable, *, mode: CreateMode = CreateMode.error_if_exists, copy_grants: bool | None = False) β†’ EventTableResourceΒΆ

Create an event table in Snowflake.

Parameters:
  • event_table (EventTable) –

    The details of EventTable object, together with EventTable’s properties:

    name ; rows, columns are optional

  • copy_grants (bool, optional) – Whether to enable copy grants when creating the object. Default is False.

  • mode (CreateMode, optional) –

    One of the below enum values.

    CreateMode.error_if_exists: Throw an snowflake.core.exceptions.ConflictError if the event table already exists in Snowflake. Equivalent to SQL create event table <name> ....

    CreateMode.or_replace: Replace if the event table already exists in Snowflake. Equivalent to SQL create or replace event table <name> ....

    CreateMode.if_not_exists: Do nothing if the event table already exists in Snowflake. Equivalent to SQL create event table <name> if not exists...

    Default value is CreateMode.error_if_exists.

Examples

Create an Event Table instance:

>>> event_tables = schema.event_tables
>>> event_tables.create(new_event_table)
Copy
items() β†’ ItemsView[str, T]ΒΆ
iter(*, like: str | None = None, starts_with: str | None = None, show_limit: int | None = None, from_name: str | None = None) β†’ Iterator[EventTable]ΒΆ

Iterate through Event Table objects from Snowflake, filtering on any optional β€˜like’ pattern.

Parameters:
  • like (str, optional) – A case-insensitive string functioning as a filter, with support for SQL wildcard characters (% and _).

  • starts_with (str, optional) – String used 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.

  • show_limit (int, optional) – Limit of the maximum number of rows returned by iter(). The default is None, which behaves equivalently to show_limit=10000. This value must be between 1 and 10000.

  • from_name (str, optional) – Fetch rows only following the first row whose object name matches the specified string. This is case-sensitive and does not have to be the full name.

Examples

Showing all event tables that you have access to see:

>>> event_tables = event_table_collection.iter()
Copy

Showing information of the exact event table you want to see:

>>> event_tables = event_table_collection.iter(like="your-event-table-name")
Copy

Showing event tables starting with β€˜your-event-table-name-β€˜:

>>> event_tables = event_table_collection.iter(like="your-event-table-name-%")
Copy

Using a for loop to retrieve information from iterator:

>>> for event_table in event_tables:
...     print(event_table.name)
Copy
keys() β†’ KeysView[str]ΒΆ
values() β†’ ValuesView[T]ΒΆ