- Schema:
ALERT_ HISTORY 视图¶
Important
This view is only available in the organization account. For more information, see Premium views in the organization account.
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.
列
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. |
其他列
| 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:
|
使用说明
- 视图的延迟时间最长可达 24 小时。
- For increased performance, filter queries on the COMPLETED_TIME or SCHEDULED_TIME column.
示例
检索最近完成的 10 次警报运行的记录:
检索过去一小时内完成的警报运行记录: