What you will be able to do
- Write alert queries on system.billing.usage to catch unexpected spend
- Monitor SQL warehouse and query health from system.query.history and system.compute.warehouse_events
- Alert on security and Genie Agent activity from system.access.audit, and identify the documented route to AI agent quality signals
- Run a Databricks SQL alert as a Lakeflow Jobs task, and branch downstream work with If/else and Run if dependencies
1.Usage and cost alerts on system.billing.usage
A Databricks SQL alert runs a query on a schedule and sends a notification when the result crosses a threshold. System tables expose platform telemetry as queryable tables, so one alert mechanism can also watch spend, warehouses, security events, and jobs. Start with cost. Users who have access to system tables can query billing records in system.billing.usage. In each record, usage_metadata identifies the resource involved, identity_metadata identifies the user or service principal, and billing_origin_product and product_features identify the product. custom_tags holds compute tags.
The answer is custom_tags. It includes tags added by serverless usage policies, which is how serverless usage gets attributed to a team. For alerts, choose a documented sample that has no parameters, since alerts can't take them. One example is the ranking of jobs by DBU usage:
SELECT
usage_metadata.job_id as `Job ID`, sum(usage_quantity) as `Usage`
FROM
system.billing.usage
WHERE
usage_metadata.job_id IS NOT NULL
GROUP BY
`Job ID`
ORDER BY
`Usage` DESCBecause this query sorts the heaviest job to the top, a condition on the first value of Usage checks the most expensive job. Several other billing samples use bind variables such as custom_tags [:key] = :value or :usage_start_time. Before using one of those as an alert, write the values directly into the SQL.
Checkpoint 1 of 8· Check yourself
Which system.billing.usage column lets you attribute serverless spend using tags from serverless usage policies?
custom_tags contains the tags on the compute resource, including tags added by serverless usage policies.
“This also includes tags added by serverless usage policies so you can attribute serverless usage.”Source: docs.databricks.com
Checkpoint 2 of 8· Exam question
A platform team wants an early-warning alert when a single workspace's daily DBU spend exceeds a threshold, broken down by the job that generated the usage. Which two actions correctly use Databricks system tables and SQL alerts to support this? (Choose 2)(Select 2)
Correct answers: A, B — Query `system.billing.usage` joined to `system.billing.list_prices`, compute daily DBU spend per workspace, and attach a SQL alert with a threshold condition to that saved query.; Join `system.billing.usage` to `system.lakeflow.jobs` on the job identifiers stored in `usage_metadata` so each day's spend rows can be attributed to the job name that generated them.
- A. This is the standard pattern for cost alerting: compute a dollar figure by joining usage to list prices, then attach a SQL alert with a threshold to that query so it evaluates on a schedule and fires when spend is exceeded.
- B. Usage rows carry job identifiers in their usage metadata, so joining to the jobs table is how spend gets attributed to a specific job name for the breakdown the team wants.
- C. Audit logs record administrative and access events, not per-job dollar costs; billing attribution belongs to the billing usage table, not the audit table.
- D. Anomaly detection profiles table freshness and completeness for data quality, not dollar thresholds; it does not evaluate a numeric spend condition against a defined limit.
- E. Cluster event logs record lifecycle events like start and terminate, not DBU-to-dollar pricing; the pricing conversion lives in the billing list-prices table, not cluster event logs.
- F. Unmasking SQL text in query history helps diagnose which statement ran, but it is unrelated to computing or alerting on daily DBU spend, which is a billing concern, not a query-text concern.
2.SQL warehouse and query health
Alerts on warehouse events or query history catch slow queries, failed sessions, and capacity problems. Four system tables cover this area, and Databricks publishes example queries for them that you can turn into alerts.
| System table | What it records |
|---|---|
| system.compute.warehouse_events | Warehouse start, stop, scale-up, and scale-down events |
| system.compute.warehouses | Snapshots of warehouse configurations |
| system.query.history | Details of every query executed on SQL warehouses |
| system.billing.usage | Billing records for all Databricks usage |
SELECT
statement_id,
executed_by,
statement_type,
execution_status,
total_duration_ms,
execution_duration_ms,
compilation_duration_ms,
waiting_at_capacity_duration_ms,
read_rows,
produced_rows,
start_time,
statement_text
FROM
system.query.history
WHERE
compute.warehouse_id = '<warehouse-id>'
AND start_time >= NOW() - INTERVAL 1 DAYEach column answers a different health question. total_duration_ms shows slow queries, execution_status shows failures, and waiting_at_capacity_duration_ms shows queries that waited because the warehouse was full. An alert set on one of these values tells you when it moves into a range you didn't expect.
Checkpoint 3 of 8· Check yourself
You want to know when a warehouse keeps scaling up. Which system table records that event?
warehouse_events records start, stop, and scaling events. system.compute.warehouses only holds configuration snapshots.
“Tracks warehouse start, stop, scale-up, and scale-down events.”Source: docs.databricks.com
3.Audit and security events
For security monitoring, alert on audit log queries. The audit log system table, system.access.audit (Public Preview), records user_identity, service_name, action_name, request_params, response, and source_ip_address. Keep a few details in mind:
- Filter on event_date rather than event_time for better performance.
- Account-level events record workspace_id as 0.
- Most audit logs are only available in the region of the workspace.
- Some request_params keys that hold SQL definitions are hidden unless you are an account admin or a member of databricks_pii_access.
The documented example monitors Genie Agents, formerly called Genie Spaces. You can then set an alert to automate the check.
Checkpoint 4 of 8· Fill the gap
This query returns Genie Agent feedback ratings from the last 30 days. Which service name completes it?
SELECT
user_identity.email as user_email,
action_name,
request_params.space_id,
request_params.feedback_rating,
*
FROM
system.access.audit
WHERE
service_name = ' ? '
AND action_name = 'updateConversationMessageFeedback'
AND event_date >= current_date() - interval 30 daysGenie Agent conversation feedback is logged under the aibiGenie service. The query also filters on event_date, which the audit table recommends for performance.
Source: docs.databricks.comKeys that hold SQL definitions, such as view_definition and function_info, are hidden from anyone who isn't an account admin or a member of the databricks_pii_access account-level group. All other columns are unchanged.
4.AI agent quality
The alerts overview lists agents as a target: alert on agent quality metrics so that failures and new issues come to light during development and in operation. The agent observability docs describe where those metrics come from. Production monitoring runs MLflow scorers on agent traces and attaches the results to each evaluated trace as feedback. Traces stored in Unity Catalog are governed and queryable with SQL.
These sources name the pattern but don't include a sample alert query on scorer results. Treat it as the general rule applied to agents: write a SQL query that returns a quality metric, then put an alert condition on it. The Genie feedback-rating audit query from the previous section is one documented, alertable signal of agent quality from users.
Checkpoint 5 of 8· Check yourself
With MLflow production monitoring on an agent, where do the scorer results end up?
Production monitoring writes each scorer's result back onto the trace it evaluated as feedback, which is the data a quality query can then read.
“Results are attached as feedback to each evaluated trace.”Source: docs.databricks.com
5.Alerts as tasks in Lakeflow Jobs, and branching
An alert can also run as a task in Lakeflow Jobs. The condition check then happens as part of a pipeline run instead of on a clock. The task needs an existing Databricks SQL alert, CAN RUN permission on that alert, and a serverless or pro SQL warehouse. The task evaluates the alert separately from the alert's own schedule, which the job run leaves untouched. Alert tasks don't support parameters, and they don't support legacy alerts.
Checkpoint 6 of 8· Put it in order
Put the steps for adding a SQL alert task to a new job in order
- 1.Click Create, then Job
- 2.Click Add another task type, search for SQL Alert, and select the tile
- 3.Enter a Task name
- 4.Click Jobs & Pipelines in the sidebar
- 5.Select the Databricks SQL alert from the Alert drop-down menu
You create the job first, then choose the SQL Alert task type, name the task, and pick the alert it evaluates.
“Click Add another task type. Search for SQL Alert and click the tile to select it.”Source: docs.databricks.com
resources:
jobs:
my_job:
name: my_job
tasks:
- task_key: alert_task
alert_task:
workspace_path: ./my_alert.dbalert.json
warehouse_id: 1a111111a1111aa1Lakeflow Jobs provides two ways to branch. Run if dependencies run a task based on whether upstream tasks succeeded, failed, or completed. The If/else condition task tests a boolean expression whose operands can reference job parameters, task parameters, or task values such as {{tasks.<task_name>.values.<value_name>}}. Downstream tasks depend on <task-name> (true) or <task-name> (false). Operator choice matters. == and != compare their operands as strings, so 12.0 == 12 is false. >, >=, <, and <= compare them as numbers. The condition task doesn't need a cluster, and it supports neither retries nor notifications.
Checkpoint 7 of 8· Fill the gap
In this bundle, notebook_task should run only while the job's repair count is below 5. Which operator completes the condition?
resources:
jobs:
my-job:
name: my-job
tasks:
- task_key: condition_task
condition_task:
op: ?
left: '{{job.repair_count}}'
right: '5'
- task_key: notebook_task
depends_on:
- task_key: condition_task
outcome: 'true'
notebook_task:
notebook_path: ../src/notebook.ipynbLESS_THAN with right: '5' is true while repair_count < 5, and depends_on with outcome: 'true' runs the notebook only on that branch.
Source: docs.databricks.comCheckpoint 8 of 8· Exam question
A security engineer must be alerted whenever a Unity Catalog grant is modified outside business hours across any workspace in the account. Which two design choices correctly use Databricks system tables and SQL alerts to satisfy this? (Choose 2)(Select 2)
Correct answers: A, B — Query `system.access.audit` filtering `service_name = 'unityCatalog'` and `action_name` values for grant changes, then window the query to the account's off-hours period.; Attach a Databricks SQL alert to the audit query with a threshold condition that triggers when the row count for the filtered window is greater than zero.
- A. Filtering the audit table to the Unity Catalog service and grant-related action names, scoped to off-hours, is exactly how the audit log is used to isolate the security-relevant events the engineer cares about.
- B. A SQL alert with a threshold that fires on any matching row is the standard way to turn a filtered audit query into a notification the moment a qualifying grant change appears.
- C. Billing usage records dollar cost and resource consumption, not permission changes; grant modifications are captured by the audit table, not the billing table.
- D. Anomaly detection profiles row volume and freshness patterns on data tables; Unity Catalog's internal grants metadata is not a monitored table subject to that anomaly model.
- E. job_tasks records Lakeflow job task metadata and dependencies, not catalog-level audit events; permission grant changes are not captured in that jobs-focused system table.
- F. A quarterly schedule defeats the purpose of an off-hours security alert, since a grant change made outside business hours would go undetected for months instead of being surfaced promptly.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.A SQL alert task fails when its alert condition is met, so a Run if dependency on failure catches triggered alerts.Why is that wrong?
The task reports Succeeded whether or not the condition triggered. It reports Failed only when evaluation errors, for example a warehouse connection problem or a query error.
2.An If/else condition of {{tasks.check.values.score}} == 12 is true when the task value is 12.0.Why is that wrong?
== and != compare their operands as strings, so 12.0 == 12 evaluates to false. Use a numeric operator such as >= when the comparison has to be numeric.
3.Adding an alert to a job as a SQL alert task replaces the alert's own schedule.Why is that wrong?
The task evaluates the alert separately, and the schedule on the underlying alert keeps running unchanged.
Practise it for real
Build a cost alert on system.billing.usage and run it as a SQL alert task in a Lakeflow job
1.Click Alerts in the sidebar, then click Create Alert. Paste the jobs-by-DBU query (SELECT usage_metadata.job_id ... FROM system.billing.usage ... ORDER BY
UsageDESC) and click Run all.Why: The alert owns its query, and this sample has no parameters, which alerts don't support.
You should see: A result table of job IDs, sorted by Usage from highest to lowest.
2.Pick a SQL warehouse in the compute selector. In Condition, choose the first value of the Usage column, the > operator, and a static threshold of your choice.
Why: Because the query sorts descending, the first value is the most expensive job.
You should see: The condition panel shows Usage > your threshold.
3.Click Test condition, then lower the threshold until the alert would trigger.
Why: This confirms the condition logic before any notification goes out.
You should see: The preview reports TRIGGERED at a low threshold and OK at a high one.
4.Add yourself under Notifications, set a schedule with the calendar icon, and click View alert.
Why: A saved, scheduled alert is required before a job can use it.
You should see: The details page shows the alert and its evaluation history, plus a Run now button.
5.In Jobs & Pipelines, click Create, then Job. Add a SQL Alert task, select your alert, and choose a serverless or pro SQL warehouse. Run the job.
Why: Running the alert as a task moves the check into a pipeline run, independent of the alert's own schedule.
You should see: The task reports Succeeded whether your alert evaluated to OK or TRIGGERED.
Stuck? Get a nudge
If the job task shows Failed, check the warehouse type and your CAN RUN permission on the alert. Failed means evaluation errored; it never means the condition was met.
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
“Build alerts on system tables for serverless billing or ingestion to catch unexpected spend.”
↩︎ Usage and cost alerts on system.billing.usage“Alert on warehouse events or query history to catch slow queries, failed sessions, or capacity issues.”
↩︎ SQL warehouse and query health“Alert on audit log queries to flag unusual workspace activity.”
↩︎ Audit and security events“Alert on agent quality metrics so failures and emerging issues surface during development and operation.”
↩︎ AI agent quality“Add an alert as a task so condition checks run on a pipeline trigger and downstream tasks can branch on the result.”
↩︎ Alerts as tasks in Lakeflow Jobs, and branching - 2.
“You can also add alerts to your queries to help you stay informed about usage data.”
↩︎ Usage and cost alerts on system.billing.usage“This also includes tags added by serverless usage policies so you can attribute serverless usage.”
↩︎ Checkpoint - 3.
“Add alerts to get notified of unexpected values.”
↩︎ SQL warehouse and query health“Tracks warehouse start, stop, scale-up, and scale-down events.”
↩︎ Checkpoint - 4.
“To improve query performance, filter on event_date rather than event_time.”
↩︎ Audit and security events“Those keys are omitted unless you are an account admin or a member of the databricks_pii_access account-level group”
↩︎ Audit and security events - 5.
“You can set alerts to help automate this type of monitoring.”
↩︎ Audit and security events - 6.
“Results are attached as feedback to each evaluated trace.”
↩︎ AI agent quality - 7.
“governed, SQL-queryable, and the data foundation for everything else”
↩︎ AI agent quality - 8.https://docs.databricks.com/aws/en/jobs/tasks/alertOfficial docs
“You must have at least CAN RUN permission on the alert you want to use.”
↩︎ Alerts as tasks in Lakeflow Jobs, and branching“Failed: An error occurred during alert evaluation, such as a SQL warehouse connectivity issue or a query error.”
↩︎ Exam trap 1“The SQL alert task evaluates the alert independently from any schedule configured on the alert itself.”
↩︎ Exam trap 3“Click Add another task type. Search for SQL Alert and click the tile to select it.”
↩︎ Checkpoint“The alert was evaluated successfully, regardless of whether the alert condition was triggered or not.”
↩︎ Prediction - 9.https://docs.databricks.com/aws/en/jobs/run-ifOfficial docs
“The Run if dependencies field allows you to add control flow logic to tasks based on other tasks' success, failure, or completion.”
↩︎ Alerts as tasks in Lakeflow Jobs, and branching - 10.
“The condition task does not require a cluster to execute and does not support retries or notifications.”
↩︎ Alerts as tasks in Lakeflow Jobs, and branching
Also cited
“The == and != operators perform string comparison of their operands.”
↩︎ Exam trap 2