EXECUTE ALERT

Manually executes an alert independent of the schedule for the alert.

Tip

You can also use the Snowflake REST APIs to perform this operation. For information, see Execute an alert (REST endpoint reference).

See also:

CREATE ALERT , ALTER ALERT , DROP ALERT , SHOW ALERTS , DESCRIBE ALERT

Syntax

EXECUTE ALERT <name>
Copy

Parameters

name

Identifier for the alert to execute.

If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

Access control requirements

A role used to execute this SQL command must have the following privileges at a minimum:

Privilege

Object

Notes

EXECUTE ALERT

Account

OWNERSHIP or OPERATE

Alert

USAGE

Warehouse

Required on the warehouse used for the alert.

The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes

  • Alerts always run with the privileges of the owner of the alert, even if a different role with the OPERATE privilege uses EXECUTE ALERT to execute the alert.

  • If the alert is currently suspended, the EXECUTE ALERT command executes the alert but does not resume the alert. The alert remains suspended.

  • If the alert is currently running (meaning that the state of the alert in the ALERT_HISTORY table function output or the ALERT_HISTORY view is EXECUTING), the EXECUTE ALERT command schedules another run of the alert to start immediately after the current run is completed.

  • If the alert is currently scheduled (meaning that the state of the alert in the ALERT_HISTORY table function output or the ALERT_HISTORY view is SCHEDULED), the scheduled run is replaced with the requested run and the current timestamp is set to the scheduled time.

    However, if the scheduled time has passed but the alert has not yet transitioned to the EXECUTING state, the scheduled run occurs as usual. (The scheduled run is not replaced with the run requested by the EXECUTE ALERT command.)

Examples

The following statement manually triggers an alert named myalert:

EXECUTE ALERT myalert;
Copy