Configuring a task to send error notifications

To enable a task to send error notifications, you must associate the task with a notification integration. You can do this when running the CREATE TASK command to create a new task or the ALTER TASK command to modify an existing task. When running these commands, set ERROR_NOTIFICATION to the name of the notification integration.

Error notification integration is only specified on a root task, any failed child task in the same task tree sends error notifications to the integration.

Note

Creating or modifying a task that references a notification integration requires a role that has the USAGE privilege on the notification integration. In addition, the role must have either the CREATE TASK privilege on the schema or the OWNERSHIP privilege on the task, respectively.

Creating a new task that sends error notifications

Create a new task using CREATE TASK. For descriptions of all available task parameters, see the SQL command topic:

CREATE TASK <name>
  [...]
  ERROR_INTEGRATION = <integration_name>
  AS <sql>
Copy

Where:

ERROR_INTEGRATION = integration_name

Name of the notification integration created in one of AWS SNS, Google Pub/Sub, or Azure Event Grid platform level notifications.

The following example creates a serverless task that supports error notifications. The task inserts the current timestamp into a table column every 5 minutes:

CREATE TASK mytask
  SCHEDULE = '5 MINUTE'
  ERROR_INTEGRATION = my_notification_int
  AS
  INSERT INTO mytable(ts) VALUES(CURRENT_TIMESTAMP);
Copy

Updating an existing task to send error notifications

Modify an existing task using ALTER TASK:

ALTER TASK <name> SET ERROR_INTEGRATION = <integration_name>;
Copy

Where integration_name is the name of the notification integration created in one of AWS SNS, Google Pub/Sub, or Azure Event Grid platform level notifications.

For example:

ALTER TASK mytask SET ERROR_INTEGRATION = my_notification_int;
Copy