snowflake.core.notification_integration.NotificationIntegrationCollection¶
- class snowflake.core.notification_integration.NotificationIntegrationCollection(root: Root)¶
Bases:
AccountObjectCollectionParent
[NotificationIntegrationResource
]Represents the collection operations on the Snowflake Notification Integration resource.
With this collection, you can create, update, and iterate through notification integrations that you have access to in the current context.
Examples
Creating a notification integrations instance:
>>> # This example assumes that mySecret already exists >>> notification_integrations = root.notification_integrations >>> new_ni = NotificationIntegration( ... name="my_notification_integration", ... enabled=True, ... notification_hook=NotificationWebhook( ... webhook_url="https://events.pagerduty.com/v2/enqueue", ... webhook_secret=WebhookSecret( ... name="mySecret".upper(), database_name=database, schema_name=schema ... ), ... webhook_body_template='{"key": "SNOWFLAKE_WEBHOOK_SECRET", "msg": "SNOWFLAKE_WEBHOOK_MESSAGE"}', ... webhook_headers={"content-type": "application/json", "user-content": "chrome"}, ... ) ... ) >>> notification_integrations.create(new_ni)
Attributes
- root¶
Methods
- create(notification_integration: NotificationIntegration, *, mode: CreateMode = CreateMode.error_if_exists) NotificationIntegrationResource ¶
Create a notification integration in Snowflake.
- Parameters:
notification_integration (NotificationIntegration) – The
NotificationIntegration
object, together with theNotificationIntegration
’s properties: name, enabled, notification_hook; comment is optional.mode (CreateMode, optional) –
One of the following enum values:
CreateMode.error_if_exists
: Throw ansnowflake.core.exceptions.ConflictError
if the notification integration already exists in Snowflake. Equivalent to SQLcreate notification integration <name> ...
.CreateMode.or_replace
: Replace if the notification integration already exists in Snowflake. Equivalent to SQLcreate or replace notification integration <name> ...
.CreateMode.if_not_exists
: Do nothing if the notification integration already exists in Snowflake. Equivalent to SQLcreate notification integration <name> if not exists...
Default is
CreateMode.error_if_exists
.
Examples
Creating a notification integration instance:
>>> notification_integrations.create( ... NotificationIntegration( ... name="my_notification_integration", ... notification_hook=NotificationEmail( ... allowed_recipients=["my_email@company.com"], ... default_recipients=["my_email@company.com"], ... default_subject="test default subject", ... ), ... comment="This is a comment", ... enabled=True, ... ), ... mode=CreateMode.if_not_exists, ... )
- create_async(notification_integration: NotificationIntegration, *, mode: CreateMode = CreateMode.error_if_exists) PollingOperation[NotificationIntegrationResource] ¶
An asynchronous version of
create()
.Refer to
PollingOperation
for more information on asynchronous execution and the return type.
- items() ItemsView[str, T] ¶
- iter(*, like: str | None = None) Iterator[NotificationIntegration] ¶
Iterate through
NotificationIntegration
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 _).
Examples
Showing all notification integrations that you have access to see:
>>> notification_integrations = notification_integrations.iter()
Showing information of the exact notification integration you want to see:
>>> notification_integrations = notification_integrations.iter(like="your-notification-integration-name")
Showing notification integrations starting with ‘your-notification-integration-name-‘:
>>> notification_integrations = notification_integrations.iter(like="your-notification-integration-name-%")
Using a for-loop to retrieve information from iterator:
>>> for notification_integration in notification_integrations: >>> print( ... notification_integration.name, ... notification_integration.enabled, ... repr(notification_integration.notification_hook), ... )
- iter_async(*, like: str | None = None) PollingOperation[Iterator[NotificationIntegration]] ¶
An asynchronous version of
iter()
.Refer to
PollingOperation
for more information on asynchronous execution and the return type.
- keys() KeysView[str] ¶
- values() ValuesView[T] ¶