- Schema:
For guidance on query performance when using organization-wide usage views, see Performance (Organization Usage).
ALERT_ HISTORY view¶
Important
This view is only available in the organization account. For more information, see Premium views in the organization account.
Organization Usage performance
When you query a specific view in the SNOWFLAKE.ORGANIZATION_USAGE schema, follow the organization-wide guidance in
Performance (Organization Usage): bound every scan on history views, list
columns explicitly, and use the time filter column table plus worked SQL and anti-patterns there.
This Organization Usage view enables you to retrieve the history of alert usage. The view displays one row for each run of an alert in the history.
Columns¶
Organization-level columns
| Column Name | Data Type | Description |
|---|---|---|
| ORGANIZATION_NAME | VARCHAR | Name of the organization. |
| ACCOUNT_LOCATOR | VARCHAR | System-generated identifier for the account. |
| ACCOUNT_NAME | VARCHAR | User-defined identifier for the account. |
Additional columns
| Column Name | Data Type | Description |
|---|---|---|
| NAME | VARCHAR | Name of the alert. |
| DATABASE_NAME | VARCHAR | Name of the database that contains the alert. |
| SCHEMA_NAME | VARCHAR | Name of the schema that contains the alert. |
| ACTION | VARCHAR | The text of the SQL statement that serves as the action for the alert. |
| ACTION_QUERY_ID | VARCHAR | Internal/system-generated identifier for the SQL statement executed as the action of the alert. |
| CONDITION | VARCHAR | The text of the SQL statement that serves as the condition for the alert. |
| CONDITION_QUERY_ID | VARCHAR | Internal/system-generated identifier for the SQL statement executed as the condition of the alert. |
| ERROR_CODE | NUMBER | Error code, if the alert returned an error or failed to execute (e.g. if the current user did not have privileges to execute the alert). |
| ERROR_MESSAGE | VARCHAR | Error message, if the alert returned an error. |
| STATE | VARCHAR | Status of the alert. This can be one of the following:
|
| SCHEDULED_TIME | TIMESTAMP_LTZ | Time when the scheduled alert is/was scheduled to start running. Note that we make a best effort to ensure absolute precision, but only guarantee that alerts do not execute before the scheduled time. |
| COMPLETED_TIME | TIMESTAMP_LTZ | Time when the alert completed, or NULL if SCHEDULED_TIME is in the future or if the alert is still running. |
| DATABASE_ID | NUMBER | Internal/system-generated identifier for the database containing the schema. |
| SCHEMA_ID | NUMBER | Internal/system-generated identifier for the schema. |
| SCHEDULED_FROM | VARCHAR | Specifies what initiated the alert. The column contains one of the following values:
|
| RUNBOOK | VARCHAR | URL or free-text reference to a runbook for this alert. Returns NULL if not set. |
| WAS_AUTO_SUSPENDED | BOOLEAN | Indicates whether the alert was automatically suspended after this execution due to exceeding the
consecutive failure threshold set by the
|
| CONFIG | VARCHAR | JSON configuration string stored on the alert at the time of this execution. Returns NULL if not set. |
Usage notes¶
- Latency for the view may be up to 24 hours.
- For increased performance, filter queries on the COMPLETED_TIME or SCHEDULED_TIME column.
Examples¶
Retrieve records for the 10 most recent completed alert runs:
Retrieve records for alert runs completed in the past hour: