snowflake.core.alert.AlertResource

class snowflake.core.alert.AlertResource(name: Annotated[str, Strict(strict=True)], collection: AlertCollection)

Bases: SchemaObjectReferenceMixin[AlertCollection]

Represents a reference to a Snowflake Alert resource.

With this alert reference, you can create, update, delete, and fetch information about alerts, as well as perform certain actions on them.

Attributes

database

The DatabaseResource this reference belongs to.

fully_qualified_name

Return the fully qualified name of the object this reference points to.

root

The Root object this reference belongs to.

Methods

drop(if_exists: bool = False) None

Drop this alert.

Parameters:

if_exists (bool, optional) – Check the existence of this alert before drop. The default value is False.

Examples

Deleting an alert using its reference, erroring if it doesn’t exist:

>>> alert_reference.drop()
Copy

Deleting an alert using its reference if it exists:

>>> alert_reference.drop(if_exists=True)
Copy
drop_async(if_exists: bool = False) PollingOperation[None]

An asynchronous version of drop().

Refer to PollingOperation for more information on asynchronous execution and the return type.

execute() None

Execute an alert.

Examples

Use an alert reference to execute it:

>>> alert_reference.execute()
Copy
execute_async() PollingOperation[None]

An asynchronous version of execute().

Refer to PollingOperation for more information on asynchronous execution and the return type.

fetch() Alert

Fetch the details of an alert.

Examples

Fetching an alert reference to print its name and query properties:

>>> my_alert = alert_reference.fetch()
>>> print(my_alert.name, my_alert.condition, my_alert.action)
Copy
fetch_async() PollingOperation[Alert]

An asynchronous version of fetch().

Refer to PollingOperation for more information on asynchronous execution and the return type.

Language: English