SQL alert task for jobs
This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Databricks previews.
Use a SQL alert task to evaluate a Databricks SQL alert as part of a job. SQL alert tasks allow you to integrate alert-based monitoring into your data pipelines, enabling automated condition checks and notifications alongside other job tasks. To learn more about Databricks SQL alerts, see Databricks SQL alerts.
Prerequisites
To use the SQL alert task, you must meet the following prerequisites:
- A workspace admin must enable the preview. See Manage Databricks previews.
- You must have an existing Databricks SQL alert in your workspace. To create an alert, see Create an alert.
- You must have at least CAN RUN permission on the alert you want to use.
- You must have access to a serverless or pro SQL warehouse.
Configure a SQL alert task
The jobs UI displays options dynamically based on other configured settings. To configure a SQL Alert task:
- In your workspace, click
Jobs & Pipelines in the sidebar.
- Click Create, then Job.
- Click Add another task type. Search for SQL Alert and click the tile to select it.
- Enter a Task name.
- In the Alert drop-down menu, select the Databricks SQL alert that you want to evaluate.
- (Optional) In the SQL warehouse drop-down menu, select the SQL warehouse to use for running the alert query. If not set, the alert's internal warehouse is used. You must use a serverless or pro SQL warehouse for SQL alert tasks.
- (Optional) In the Subscribers drop-down, choose the users and notification destinations that should receive notifications with the alert results. If not set, the alert's internal subscribers (if applicable) receive notifications.
- (Optional) To configure Duration threshold, Notifications, or Retries, see Advanced task settings.
- Click Save task.
SQL alert task behavior
When a job runs a SQL alert task, the following occurs:
- The alert's query executes on the specified SQL warehouse.
- The alert condition is evaluated against the query results.
- Subscribers configured on the task receive notifications based on the alert outcome.
The SQL alert task reports one of the following statuses:
- Succeeded: The alert was evaluated successfully, regardless of whether the alert condition was triggered or not.
- Failed: An error occurred during alert evaluation, such as a SQL warehouse connectivity issue or a query error.
The SQL alert task evaluates the alert independently from any schedule configured on the alert itself. Schedules on the underlying alert are not affected by the job run.
Limitations
- SQL alert tasks do not support parameters. If you need to use parameterized queries, consider using a SQL task instead.
- During the Beta period, SQL alert tasks support only Databricks SQL alerts. Legacy alerts are not supported.