What you will be able to do
- Explain how a Databricks SQL alert evaluates a scheduled query against a condition and which statuses it can return
- Write alert queries that use aggregations, multicolumn logic, and Unity Catalog metric views for governed business metrics
- Configure notifications and templates, and spot alerts that were skipped because of the active-run limit
- Tell profile alerts on data profiling metrics tables apart from anomaly detection alert rules
Key concept
Alert = scheduled query + condition — A Databricks SQL alert owns one SQL query. It runs that query on a schedule, tests the result against a threshold you define, and sends a notification when the result breaks it. Every monitoring use case in this objective comes down to writing the right query for this mechanism.
1.How an alert evaluates
An alert is the monitoring tool for the whole lakehouse. It can watch business KPIs, data quality, cost trends, and operational problems, because it watches whatever a SQL query returns. The alert editor puts every part of an alert on one screen. You write and test the query, pick the SQL warehouse that runs it, set a periodic schedule, define the condition, and choose who gets notified. You can also share the alert and open advanced settings.
| Editor component | What it controls |
|---|---|
| Query editor | The SQL whose result is evaluated |
| Compute | The SQL warehouse that runs the alert query |
| Schedule | The periodic schedule, optionally in Quartz Cron Syntax |
| Condition | The value threshold that triggers a notification; Test condition previews it |
| Notifications | Users or notification destinations to alert, plus an optional notification frequency that repeats until the alert returns to OK |
| Advanced | Notify on OK, Empty result state, and the notification Template |
The condition has three parts: a value, an operator, and a threshold. The value can be the first value of a column in the result, or an aggregation such as SUM or AVERAGE across every row of one column. The threshold is a static value by default. In the documented tutorial, the alert sums the amount column of a daily taxi-fare query, triggers when the sum is greater than 4000, and runs every 5 minutes. Alerts do not accept queries with parameters, so any filter values must be written directly into the SQL.
Current alerts differ from legacy alerts in two ways that matter on the exam. First, an evaluation can only resolve to OK, TRIGGERED, or ERROR. Second, an alert cannot point at an existing saved query: each alert owns its own query definition, which you write in the alert editor. Legacy and current alerts can run side by side while you migrate. Each alert also keeps a history of past evaluations, which you can open on its details page.
Checkpoint 1 of 5· Check yourself
An analyst wants to build a new Databricks SQL alert on the saved query 'Daily revenue', which already powers a dashboard. What happens?
Current alerts own their query definition, so you write the SQL in the alert editor instead of attaching a saved query.
“An existing saved SQL query cannot be reused when creating an alert.”Source: docs.databricks.com
2.Alert query patterns and governed business metrics
Choosing an aggregation in the condition changes the SQL that runs. The alert wraps your query in a common table expression and aggregates over that CTE. For example, a SUM condition on SELECT 1 AS column_name runs the following query:
WITH q AS (SELECT 1 AS column_name) SELECT SUM(column_name) FROM qOne side effect follows from that rewrite. A custom notification body can't show the rows from before aggregation, because the alert only ever sees the aggregated result. A condition also checks only one column. When the rule depends on several columns, put the logic in the query and return a flag, then trigger the alert when the flag equals 1:
SELECT CASE WHEN drafts_count > 10000 AND archived_count > 5000 THEN 1 ELSE 0 END
FROM (
SELECT sum(CASE WHEN is_archived THEN 1 ELSE 0 END) AS archived_count,
sum(CASE WHEN is_draft THEN 1 ELSE 0 END) AS drafts_count
FROM queries) dataFor governed business metrics, alert on a Unity Catalog metric view. This needs no special setup: an alert on a metric view works like an alert on any other dataset, and you reference the view by its fully qualified name in the alert query. The alert then evaluates the same governed metric definition that the rest of the organization uses, not a copy of the logic written into the alert.
Checkpoint 2 of 5· Check yourself
An alert uses a SUM aggregation on the amount column. Its custom template includes {{QUERY_RESULT_ROWS}}. What does the notification show?
The alert wraps the query in a CTE and aggregates it, so the template variables only see the aggregated result.
“those variables will only display the final, post-aggregation query result.”Source: docs.databricks.com
Checkpoint 3 of 5· Exam question
Your team migrated a set of legacy Databricks SQL alerts to the current alert editor to consolidate monitoring for governed business-metric dashboards. When reviewing alert history after the migration, which statement about the alert status model is accurate?
Correct answer: A — Alerts now report status as one of OK, Triggered, or Error, and the previously used Unknown status has been removed from the evaluation model.
- A. The current alert editor evaluates each alert to OK, Triggered, or Error, and it explicitly no longer supports the Unknown status that legacy alerts used. This is the correct, up-to-date status model for monitoring governed metrics.
- B. Unknown was part of the legacy alert status model, not the current one. Carrying that assumption forward after a migration to the new editor leads teams to misinterpret alert history.
- C. Healthy and Unhealthy are the status labels used by Lakehouse Monitoring anomaly detection for table health badges, not the status vocabulary used by SQL alerts themselves.
- D. SQL alerts do not have a manual-acknowledgement Pending/Resolved workflow; their status is derived automatically from evaluating the query condition on each scheduled run.
3.Notifications, templates, and skipped runs
Advanced settings control what reaches people. Notify on OK sends a message when the alert recovers. Empty result state sets the status to return when the query produces no rows. Template replaces the default message. Workspace admins set up notification destinations. In the standard template editor you insert variables as {{VARIABLE_NAME}}. The Markdown editor uses @VARIABLE_NAME and supports a smaller set of variables.
| Variable | Contents |
|---|---|
| ALERT_STATUS | The evaluated alert status |
| ALERT_CONDITION / ALERT_THRESHOLD | The condition operator and the threshold |
| ALERT_NAME / ALERT_URL | The alert name and the alert page URL |
| QUERY_RESULT_VALUE | The query result value |
| QUERY_RESULT_TABLE | An HTML table of the first 100 rows; only email destinations render HTML |
| QUERY_RESULT_ROWS / QUERY_RESULT_COLS | The result rows and the column names |
Alerts compete for run slots. Each workspace allows 250 simultaneous active alert runs by default. If every slot is busy when a scheduled alert fires, that run is skipped and the alert doesn't evaluate at all. To spot this, look for gaps in the evaluation history at the scheduled time. In the typical case, all the affected alerts share one schedule. To fix it, stagger the schedules, for example 01:30, 01:32, 01:34. If the workspace hits the limit consistently, Databricks Support can raise the quota.
A manual Run now happens outside the concurrency spike. The skips come from many alerts firing on the same schedule and using up the 250 run slots, not from a problem in the alert itself.
Checkpoint 4 of 5· Check yourself
Two hundred and eighty alerts are all scheduled for 01:30. Several of them show gaps in their evaluation history at that time, yet Run now works on each one. What is the recommended first fix?
The runs were skipped at the active-run limit. Spreading the schedules lowers how many alerts need a run slot at once.
“stagger alert schedules so they do not all fire at the same time”Source: docs.databricks.com
Sources2
4.Data quality and anomaly signals
Data quality alerts come in two forms, and they work differently. A profile alert is an ordinary Databricks SQL alert. You write a query on the profile metrics table or the drift metrics table that data profiling produces, then build an alert on that query. Use it when a statistic leaves a range, such as the fraction of missing values, or when the data drifts from a baseline. Email is the default, and you can also send to a webhook, Slack, or PagerDuty.
Anomaly detection alert rules (Beta) don't use the SQL alert editor at all. You create them under Manage alerts in the Data Quality Monitoring UI, where each rule covers one catalog or one schema. When a monitored table in that scope becomes unhealthy, for example stale or with an unexpected drop in row count, each recipient receives one email per important unhealthy table. Creating a rule needs the MANAGE privilege at the level of its scope.
| Aspect | Profile alert | Anomaly detection alert rule |
|---|---|---|
| What it is | A Databricks SQL alert | A rule in the Data Quality Monitoring UI (Beta) |
| Where you set it up | A SQL query on the profile metrics or drift metrics table | Manage alerts > Create alert |
| Scope | Whatever the query selects | A catalog (All Schemas) or one schema |
| Delivery | Email by default; webhook, Slack, or PagerDuty also possible | Email to selected workspace users, one per important unhealthy table |
| Privilege to create | Same as any other SQL alert | MANAGE on the schema or catalog |
Checkpoint 5 of 5· Match them up
Match each data quality alerting setup to what it requires
Tap a term, then the definition that fits it.
Anomaly detection rules check the privilege at the level of their scope. Profile alerts are standard SQL alerts built on a query over a metrics table.
“To create a schema-level alert, you must have the MANAGE privilege on the schema.”Source: docs.databricks.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Anomaly detection alerts are Databricks SQL alerts that you build on a query and run on a SQL warehouse.Why is that wrong?
Anomaly detection alert rules are created in the Data Quality Monitoring UI. Each one covers a catalog or a schema and emails recipients about unhealthy tables. Profile alerts are the SQL-alert form.
Covered in Data quality and anomaly signals
2.If Run now succeeds, the alert's scheduled runs must be evaluating too.Why is that wrong?
Once all of the workspace's active alert run slots are in use, a scheduled run is skipped and never evaluates. A manual run outside that spike can still succeed.
Covered in Notifications, templates, and skipped runs
3.An alert can use a parameterized query, and the parameters are filled in at evaluation time.Why is that wrong?
Alerts don't support queries with parameters. Filter values have to be written into the alert's SQL.
Covered in How an alert evaluates
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/sql/user/alertsOfficial docs
“Evaluations resolve to OK, TRIGGERED, or ERROR.”
↩︎ How an alert evaluates“Reference a Unity Catalog metric view by its fully qualified name in the alert query to monitor governed business metrics.”
↩︎ Alert query patterns and governed business metrics“Databricks SQL alerts run queries on a schedule and notify you when a condition that you define is met against the query result.”
↩︎ Key concept“alerts no longer support the UNKNOWN status from legacy alerts”
↩︎ Prediction“An existing saved SQL query cannot be reused when creating an alert.”
↩︎ Checkpoint - 2.
“set an aggregation across all rows of a single column, such as SUM or AVERAGE”
↩︎ How an alert evaluates“Each workspace has a default limit of 250 simultaneous active alert runs.”
↩︎ Notifications, templates, and skipped runs“Empty result state: Set a special status to return when the query returns no results.”
↩︎ Notifications, templates, and skipped runs“When all run slots are in use and a scheduled alert fires, the alert run is skipped and the alert does not evaluate.”
↩︎ Exam trap 2“Alerts do not support queries with parameters.”
↩︎ Exam trap 3“stagger alert schedules so they do not all fire at the same time”
↩︎ Checkpoint - 3.
“The alert wraps the original query text in a common table expression (CTE) and performs a wrapping aggregation query on it”
↩︎ Alert query patterns and governed business metrics“those variables will only display the final, post-aggregation query result.”
↩︎ Checkpoint - 4.
“You create a Databricks SQL query on the profile metrics table or drift metrics table.”
↩︎ Data quality and anomaly signals - 5.https://docs.databricks.com/aws/en/data-governance/unity-catalog/data-quality-monitoring/anomaly-detection/alertsOfficial docs
“each recipient receives one email per important unhealthy table.”
↩︎ Data quality and anomaly signals“Each alert rule is scoped to a catalog or a specific schema.”
↩︎ Exam trap 1“To create a schema-level alert, you must have the MANAGE privilege on the schema.”
↩︎ Checkpoint