Skip to main content

Alert

View as Markdown

A legacy Databricks SQL alert. An alert runs a saved query, compares a column of the result against a threshold, and notifies its subscribers when the condition is met. See https://docs.databricks.com/aws/en/sql/user/alerts/legacy for details.

Alert object​

A legacy Databricks SQL alert. An alert runs a saved query, compares a column of the result against a threshold, and notifies its subscribers when the condition is met. See https://docs.databricks.com/aws/en/sql/user/alerts/legacy for details.

idstringIDImmutable

UUID identifying the alert.

Example: fe25e731-92f2-4838-9fb2-1ca364320a3d

display_namestring

Display name of the alert, shown in list views and notifications. It must not be empty.

Example: Example alert

query_idstring

UUID of the saved query whose result the alert evaluates. The caller must have permission to view the query.

Example: dee5cca8-1c79-4b5e-a711-e7f9d241bdf6

statestring

Current state of the alert's trigger status: TRIGGERED if the condition was met on the last evaluation, OK if it was not, and UNKNOWN if the alert has not yet been evaluated or ran into an error during the last evaluation.

Values:

  • UNKNOWN
  • OK
  • TRIGGERED

Example: UNKNOWN

seconds_to_retriggerint32

Number of seconds the alert waits after a notification before it can notify again while its state stays TRIGGERED. If 0 or not specified, the alert notifies once when its state changes to TRIGGERED and does not notify again until its state has changed.

Example: 0

lifecycle_statestring

Lifecycle state of the alert: ACTIVE, or TRASHED after it has been moved to the trash.

Values:

  • ACTIVE
  • TRASHED

Example: ACTIVE

trigger_timestring

Timestamp when the alert was last triggered, if the alert has been triggered before.

custom_bodystring

Custom body of the alert notification. It can use the template variables and HTML described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default notification body is used.

Example: {{ALERT_COLUMN}} is {{QUERY_RESULT_VALUE}}, above the threshold of {{ALERT_THRESHOLD}}.

custom_subjectstring

Custom subject of the alert notification, used as the email subject or the Slack message header. It can use the template variables described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default subject is used.

Example: {{ALERT_NAME}} is {{ALERT_STATUS}}

conditionobject

Condition that triggers the alert: a column of the query result, a comparison operator, and a threshold value. The value in the first row of the column is evaluated; aggregations are not supported through this API.

Show child attributesHide child attributes
opstring

Comparison operator applied between the operand column value and the threshold. The alert is triggered when the comparison is true. IS_NULL triggers when the column value is null; a threshold must still be supplied but its value is ignored.

Values:

  • GREATER_THAN
  • GREATER_THAN_OR_EQUAL
  • LESS_THAN
  • LESS_THAN_OR_EQUAL
  • EQUAL
  • NOT_EQUAL
  • IS_NULL
operandobject

Left-hand side of the comparison. Through this API it must be a column naming a column of the query result; the value in the first row of that column is compared against the threshold.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

thresholdobject

Right-hand side of the comparison. Through this API it must be a fixed value whose type matches the operand column.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

empty_result_statestring

State the alert takes when the query returns no rows. Defaults to UNKNOWN when not set.

Values:

  • UNKNOWN
  • OK
  • TRIGGERED
owner_user_namestring

The owner's username. This field is set to "Unavailable" if the user has been deleted.

Example: user@acme.com

parent_pathstring

Workspace path of the folder containing the alert. Defaults to the creator's home folder when omitted on create. It cannot be changed after creation.

Example: /Users/user@acme.com

create_timestring

The timestamp indicating when the alert was created.

update_timestring

The timestamp indicating when the alert was updated.

notify_on_okboolean

Whether to notify subscribers when the alert state changes from TRIGGERED back to OK. Defaults to true.

Get an alert GA​

GET /api/2.0/sql/alerts/{id}

Gets an alert.

API scopes: sql

Parameters​

idstringRequiredpath

UUID of the alert to fetch.

Response​

Returns the Alert object.

List alerts GA​

GET /api/2.0/sql/alerts

Gets a list of alerts accessible to the user, ordered by creation time. Warning: Calling this API concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.

API scopes: sql

Parameters​

page_tokenstringquery

Token from the next_page_token of a previous response. Omit it to fetch the first page.

page_sizeint32<= 100query

Maximum number of alerts to return per page.

Default: 20

Response​

resultsarray of object

Alerts on this page.

Show child attributesHide child attributes
idstringIDImmutable

UUID identifying the alert.

Example: fe25e731-92f2-4838-9fb2-1ca364320a3d

display_namestring

Display name of the alert, shown in list views and notifications. It must not be empty.

Example: Example alert

query_idstring

UUID of the saved query whose result the alert evaluates. The caller must have permission to view the query.

Example: dee5cca8-1c79-4b5e-a711-e7f9d241bdf6

statestring

Current state of the alert's trigger status: TRIGGERED if the condition was met on the last evaluation, OK if it was not, and UNKNOWN if the alert has not yet been evaluated or ran into an error during the last evaluation.

Values:

  • UNKNOWN
  • OK
  • TRIGGERED

Example: UNKNOWN

seconds_to_retriggerint32

Number of seconds the alert waits after a notification before it can notify again while its state stays TRIGGERED. If 0 or not specified, the alert notifies once when its state changes to TRIGGERED and does not notify again until its state has changed.

Example: 0

lifecycle_statestring

Lifecycle state of the alert: ACTIVE, or TRASHED after it has been moved to the trash.

Values:

  • ACTIVE
  • TRASHED

Example: ACTIVE

trigger_timestring

Timestamp when the alert was last triggered, if the alert has been triggered before.

custom_bodystring

Custom body of the alert notification. It can use the template variables and HTML described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default notification body is used.

Example: {{ALERT_COLUMN}} is {{QUERY_RESULT_VALUE}}, above the threshold of {{ALERT_THRESHOLD}}.

custom_subjectstring

Custom subject of the alert notification, used as the email subject or the Slack message header. It can use the template variables described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default subject is used.

Example: {{ALERT_NAME}} is {{ALERT_STATUS}}

conditionobject

Condition that triggers the alert: a column of the query result, a comparison operator, and a threshold value. The value in the first row of the column is evaluated; aggregations are not supported through this API.

Show child attributesHide child attributes
opstring

Comparison operator applied between the operand column value and the threshold. The alert is triggered when the comparison is true. IS_NULL triggers when the column value is null; a threshold must still be supplied but its value is ignored.

Values:

  • GREATER_THAN
  • GREATER_THAN_OR_EQUAL
  • LESS_THAN
  • LESS_THAN_OR_EQUAL
  • EQUAL
  • NOT_EQUAL
  • IS_NULL
operandobject

Left-hand side of the comparison. Through this API it must be a column naming a column of the query result; the value in the first row of that column is compared against the threshold.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

thresholdobject

Right-hand side of the comparison. Through this API it must be a fixed value whose type matches the operand column.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

empty_result_statestring

State the alert takes when the query returns no rows. Defaults to UNKNOWN when not set.

Values:

  • UNKNOWN
  • OK
  • TRIGGERED
owner_user_namestring

The owner's username. This field is set to "Unavailable" if the user has been deleted.

Example: user@acme.com

create_timestring

The timestamp indicating when the alert was created.

update_timestring

The timestamp indicating when the alert was updated.

notify_on_okboolean

Whether to notify subscribers when the alert state changes from TRIGGERED back to OK. Defaults to true.

next_page_tokenstring

Token to pass as page_token to fetch the next page. Omitted when there are no more pages.

Create an alert GA​

POST /api/2.0/sql/alerts

Creates an alert.

API scopes: sql

Request body​

alertobject

The alert to create. A display name, a query_id, and a condition are required.

Show child attributesHide child attributes
display_namestring

Display name of the alert, shown in list views and notifications. It must not be empty.

Example: Example alert

query_idstring

UUID of the saved query whose result the alert evaluates. The caller must have permission to view the query.

Example: dee5cca8-1c79-4b5e-a711-e7f9d241bdf6

seconds_to_retriggerint32

Number of seconds the alert waits after a notification before it can notify again while its state stays TRIGGERED. If 0 or not specified, the alert notifies once when its state changes to TRIGGERED and does not notify again until its state has changed.

Example: 0

custom_bodystring

Custom body of the alert notification. It can use the template variables and HTML described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default notification body is used.

Example: {{ALERT_COLUMN}} is {{QUERY_RESULT_VALUE}}, above the threshold of {{ALERT_THRESHOLD}}.

custom_subjectstring

Custom subject of the alert notification, used as the email subject or the Slack message header. It can use the template variables described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default subject is used.

Example: {{ALERT_NAME}} is {{ALERT_STATUS}}

conditionobject

Condition that triggers the alert: a column of the query result, a comparison operator, and a threshold value. The value in the first row of the column is evaluated; aggregations are not supported through this API.

Show child attributesHide child attributes
opstring

Comparison operator applied between the operand column value and the threshold. The alert is triggered when the comparison is true. IS_NULL triggers when the column value is null; a threshold must still be supplied but its value is ignored.

Values:

  • GREATER_THAN
  • GREATER_THAN_OR_EQUAL
  • LESS_THAN
  • LESS_THAN_OR_EQUAL
  • EQUAL
  • NOT_EQUAL
  • IS_NULL
operandobject

Left-hand side of the comparison. Through this API it must be a column naming a column of the query result; the value in the first row of that column is compared against the threshold.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

thresholdobject

Right-hand side of the comparison. Through this API it must be a fixed value whose type matches the operand column.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

empty_result_statestring

State the alert takes when the query returns no rows. Defaults to UNKNOWN when not set.

Values:

  • UNKNOWN
  • OK
  • TRIGGERED
parent_pathstring

Workspace path of the folder containing the alert. Defaults to the creator's home folder when omitted on create. It cannot be changed after creation.

Example: /Users/user@acme.com

notify_on_okboolean

Whether to notify subscribers when the alert state changes from TRIGGERED back to OK. Defaults to true.

auto_resolve_display_nameboolean

If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the alert's display name conflicts with an existing alert's display name.

Default: true

Response​

Returns the Alert object.

Update an alert GA​

PATCH /api/2.0/sql/alerts/{id}

Updates the fields of an alert named in update_mask. Changing owner_user_name requires workspace admin privileges; changing any other field requires CAN MANAGE permission on the alert.

API scopes: sql

Parameters​

idstringRequiredpath

UUID of the alert to update.

Request body​

alertobject

Alert fields to update. Only the fields named in update_mask are changed.

Show child attributesHide child attributes
display_namestring

Display name of the alert, shown in list views and notifications. It must not be empty.

Example: Example alert

query_idstring

UUID of the saved query whose result the alert evaluates. The caller must have permission to view the query.

Example: dee5cca8-1c79-4b5e-a711-e7f9d241bdf6

seconds_to_retriggerint32

Number of seconds the alert waits after a notification before it can notify again while its state stays TRIGGERED. If 0 or not specified, the alert notifies once when its state changes to TRIGGERED and does not notify again until its state has changed.

Example: 0

custom_bodystring

Custom body of the alert notification. It can use the template variables and HTML described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default notification body is used.

Example: {{ALERT_COLUMN}} is {{QUERY_RESULT_VALUE}}, above the threshold of {{ALERT_THRESHOLD}}.

custom_subjectstring

Custom subject of the alert notification, used as the email subject or the Slack message header. It can use the template variables described at https://docs.databricks.com/aws/en/sql/user/alerts/legacy. If omitted, the default subject is used.

Example: {{ALERT_NAME}} is {{ALERT_STATUS}}

conditionobject

Condition that triggers the alert: a column of the query result, a comparison operator, and a threshold value. The value in the first row of the column is evaluated; aggregations are not supported through this API.

Show child attributesHide child attributes
opstring

Comparison operator applied between the operand column value and the threshold. The alert is triggered when the comparison is true. IS_NULL triggers when the column value is null; a threshold must still be supplied but its value is ignored.

Values:

  • GREATER_THAN
  • GREATER_THAN_OR_EQUAL
  • LESS_THAN
  • LESS_THAN_OR_EQUAL
  • EQUAL
  • NOT_EQUAL
  • IS_NULL
operandobject

Left-hand side of the comparison. Through this API it must be a column naming a column of the query result; the value in the first row of that column is compared against the threshold.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

thresholdobject

Right-hand side of the comparison. Through this API it must be a fixed value whose type matches the operand column.

Show child attributesHide child attributes
valueobject

A fixed value. Used for the threshold of a condition.

Show child attributesHide child attributes
string_valuestring

String threshold, for string or timestamp columns.

Example: foo

double_valuedouble

Numeric threshold, for numeric columns.

Example: 1.25

bool_valueboolean

Boolean threshold, for boolean columns.

Example: true

columnobject

A column of the query result. Used for the operand of a condition.

Show child attributesHide child attributes
namestring

Name of the column in the query result.

Example: col

empty_result_statestring

State the alert takes when the query returns no rows. Defaults to UNKNOWN when not set.

Values:

  • UNKNOWN
  • OK
  • TRIGGERED
owner_user_namestring

The owner's username. This field is set to "Unavailable" if the user has been deleted.

Example: user@acme.com

notify_on_okboolean

Whether to notify subscribers when the alert state changes from TRIGGERED back to OK. Defaults to true.

update_maskstringRequired

Comma-separated list of the alert fields to update, such as display_name or condition. Fields not listed keep their current values.

auto_resolve_display_nameboolean

If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the alert's display name conflicts with an existing alert's display name.

Default: true

Response​

Returns the Alert object.

Delete an alert GA​

DELETE /api/2.0/sql/alerts/{id}

Moves an alert to the trash. Trashed alerts immediately disappear from searches and list views, and can no longer trigger. You can restore a trashed alert through the UI. A trashed alert is permanently deleted after 30 days.

API scopes: sql

Parameters​

idstringRequiredpath

UUID of the alert to move to the trash.