Categories:

Information Schema , Table Functions

NOTIFICATION_HISTORY¶

This table function can be used to query the history of notifications sent through Snowflake. These notifications include:

Note

This function only returns information about notifications that have been processed (notifications that were either sent out or have failed). Notifications in the queue will not be shown in the history.

Syntax¶

NOTIFICATION_HISTORY(
  [ START_TIME => <constant_expr> ]
  [, END_TIME => <constant_expr> ]
  [, INTEGRATION_NAME => '<string>' ]
  [, RESULT_LIMIT => <integer> ] )
)
Copy

Arguments¶

All the arguments are optional.

START_TIME=> constant_expr , . END_TIME=> constant_expr

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'

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

A number specifying the maximum number of rows returned by the function.

Range: 1 to 10000

Default: 100.

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

TEXT

Type of object or feature that generated the notification. Valid values include: . . TASK (for notifications from tasks) . SNOWPIPE (for notifications from Snowpipe) . STORED_PROCEDURE (for email notifications sent by calling the SYSTEM$SEND_EMAIL stored procedure)

INTEGRATION_NAME

TEXT

Name of the integration used for this notification.

MESSAGE

TEXT

Message payload.

STATUS

TEXT

Status of the notification. Valid values: SUCCESS or FAILURE.

ERROR_MESSAGE

TEXT

If the notification failed, provides details about why the notification failed.

Usage Notes¶

  • Returns results only for the ACCOUNTADMIN role, the integration owner (i.e. the role with the OWNERSHIP privilege on the integration) or a role with the USAGE privilege on the integration.

  • 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.

Examples¶

Retrieve the most recent notifications that were created in the past 24 hours.

select * from table(information_schema.notification_history())
Copy

Retrieve the most recent notifications that were created in the past hour and sent using the integration named MY_INTEGRATION.

select * from table(information_schema.notification_history(
  START_TIME=>dateadd('hour',-1,current_timestamp()),
  END_TIME=>current_timestamp(),
  RESULT_LIMIT=>100,
  INTEGRATION_NAME=>'MY_INTEGRATION'));
Copy