NOTIFICATION_HISTORY
functionsupportedIntegrations, network & secretsThis table function can be used to query the history of notifications sent through Snowflake. These notifications include: - Notifications about errors in tasks. - Notifications about errors in Snowpipe. - Notifications sent by calling SYSTEM$SEND_EMAIL or SYSTEM$SEND_SNOWFLAKE_NOTIFICATION. The rows returned represent: - Requests that are being processed. - Failed attempts at sending notifications. - Notifications that were sent successfully. The STATUS column indicates what each row represents. See Examples of output from the function.
Syntax
supportedpartialnot supportednot scored
NOTIFICATION_HISTORY(
[ START_TIME => <constant_expr> ]
[, END_TIME => <constant_expr> ]
[, INTEGRATION_NAME => '<string>' ]
[, RESULT_LIMIT => <integer> ] )
Parameters
| Name | Required | Description |
|---|---|---|
START_TIME=> constant_expr , END_TIME=> constant_expr | required | Time range (in TIMESTAMP_LTZ format) when the notification is sent out. If START_TIME is not specified, the range starts 24 hours prior to the END_TIME. If END_TIME is not specified, the default is CURRENT_TIMESTAMP. The maximum time range is 14 days. |
INTEGRATION_NAME => 'string' | required | The fully qualified name of the integration that is tied with the notification. If you omit this argument, the function returns all notifications. Default: An empty string. |
RESULT_LIMIT => integer | required | A number specifying the maximum number of rows returned by the function. Range: 1 to 10000 Default: 100 |
Usage notes
- Returns results only for the integration owner (the role with the OWNERSHIP privilege on the integration) or a role with the USAGE privilege on the integration. The ACCOUNTADMIN role doesn’t see results for an integration unless it has one of these privileges.
- When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.
Output
The function returns the following columns: Column Name | Data Type | Description CREATED | TIMESTAMP_LTZ | Timestamp when the notification was created. PROCESSED | TIMESTAMP_LTZ | Timestamp of the last attempt to send the notification. MESSAGE_SOURCE | VARCHAR | Type of object or feature that generated the notification. Valid values include: BUDGET (for notifications from budgets) TASK (for notifications from tasks) SNOWPIPE (for notifications from Snowpipe) STORED_PROCEDURE (for notifications sent by calling the SYSTEM$SEND_EMAIL or SYSTEM$SEND_SNOWFLAKE_NOTIFICATION stored procedure, including messages sent to a queue) INTEGRATION_NAME | VARCHAR | Name of the integration used for this notification. STATUS | VARCHAR | Status of the notification. Valid values are: QUEUED: The request to send the notification is being processed. SUCCESS: The notification was sent successfully. RETRIABLE_FAILURE: The attempt to send the notification failed, and the system will attempt to send the notification again. FAILURE: The system stopped trying to send the notification, either because retrying can’t fix the error or because all retries failed. ERROR_MESSAGE | VARCHAR | If the notification failed, provides details about why the notification failed. Note For webhook notifications, this column contains the body of the HTTP response, which might contain sensitive data. Before using this data, make sure to sanitize it. ID | VARCHAR | Unique ID of a request to send a notification. If Snowflake fails to send a notification and attempts to send the notification again, the function returns a row for each attempt. Each row for an attempt has the same value in the ID column but a different value in the ATTEMPT column. ATTEMPT | INTEGER | Number of the attempt made to send the notification. MESSAGE_SOURCE_INFO | OBJECT | Object containing information about the source of the notification. The fields in this object depend on the type of the source. For notifications for budgets, the object contains the following fields: budget_id: Identifier for the budget. budget_name: The name of the budget. For error notifications for tasks, the object contains the following fields: name: The name of the task graph_run_group_id: Identifier for the graph run. attempt_number: Integer representing the number of the attempt to run this task. For error notifications for Snowpipe, the object contains the pipe_name field, which specifies the name of the pipe. For notifications sent by calling the SYSTEM$SEND_SNOWFLAKE_NOTIFICATION or SYSTEM$SEND_EMAIL stored procedure, the object contains the query_id field, which specifies the ID of the statement that called the stored procedure.