Alert
A SQL alert. An alert runs a query on a schedule, evaluates the result against a condition, and notifies users or notification destinations when the condition is met.
Alert object
A SQL alert. An alert runs a query on a schedule, evaluates the result against a condition, and notifies users or notification destinations when the condition is met.
- idstringOutput onlyIDImmutable
The canonical identifier of the alert to retrieve information about.
- display_namestring
The display name of the alert.
- owner_user_namestringOutput only
The owner's username. This field is set to "Unavailable" if the user has been deleted.
- create_timestringOutput only
The timestamp indicating when the alert was created.
- update_timestringOutput only
The timestamp indicating when the alert was updated.
- parent_pathstring
The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated.
- query_textstring
Text of the query to be run.
- warehouse_idstring
ID of the SQL warehouse attached to the alert.
- run_as_user_namestringDeprecated
Deprecated: Use
run_asfield instead. This field will be removed in a future release. The run as username or application ID of service principal. On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
- evaluationobject
Condition evaluated against the query result, and who is notified when it is met.
Show child attributesHide child attributes
- sourceobject
Source column from result to use to evaluate alert
Show child attributesHide child attributes
- namestring
Name of the column in the query result.
- displaystring
Label for the column in notifications. Defaults to
name.
- aggregationstring
Aggregation applied to the column across all rows of the query result:
SUM,COUNT,COUNT_DISTINCT,AVG,MEDIAN,MIN,MAXorSTDDEV. If not set, the value in the first row is used, which is equivalent to usingFirst rowin the UI.SUMCOUNTCOUNT_DISTINCTAVGMEDIANMINMAXSTDDEV
- comparison_operatorstring
Operator used for comparison in alert evaluation. The alert is triggered when the comparison of the source value with the threshold is true.
IS_NULLandIS_NOT_NULLtake no threshold.LESS_THANGREATER_THANEQUALNOT_EQUALGREATER_THAN_OR_EQUALLESS_THAN_OR_EQUALIS_NULLIS_NOT_NULL
- thresholdobject
Threshold to compare the source column against, either another column or a fixed value. Not needed when
comparison_operatorisIS_NULLorIS_NOT_NULL.Show child attributesHide child attributes
- columnobject
Compare the source against another column of the query result.
Show child attributesHide child attributes
- namestring
Name of the column in the query result.
- displaystring
Label for the column in notifications. Defaults to
name.
- aggregationstring
Aggregation applied to the column across all rows of the query result:
SUM,COUNT,COUNT_DISTINCT,AVG,MEDIAN,MIN,MAXorSTDDEV. If not set, the value in the first row is used, which is equivalent to usingFirst rowin the UI.SUMCOUNTCOUNT_DISTINCTAVGMEDIANMINMAXSTDDEV
- valueobject
Compare the source against a fixed value.
Show child attributesHide child attributes
- string_valuestring
String threshold, for string or timestamp columns.
- double_valuedouble
Numeric threshold, for numeric columns.
- bool_valueboolean
Boolean threshold, for boolean columns.
- notificationobject
User or Notification Destination to notify when alert is triggered.
Show child attributesHide child attributes
- subscriptionsarray of objectUnordered list
Users and notification destinations that receive notifications.
Show child attributesHide child attributes
- user_emailstring
Email address of the workspace user to notify.
- destination_idstring
ID of the notification destination to notify, as returned by the Notification Destinations API.
- retrigger_secondsint32
Number of seconds an alert waits after being triggered before it is allowed to send another notification. If set to 0 or omitted, the alert will not send any further notifications after the first trigger Setting this value to 1 allows the alert to send a notification on every evaluation where the condition is met, effectively making it always retrigger for notification purposes.
- notify_on_okboolean
Whether to notify alert subscribers when alert returns back to normal.
- statestringOutput only
Latest state of alert evaluation:
TRIGGEREDwhen the condition was met,OKwhen it was not, andERRORwhen the evaluation failed.UNKNOWNTRIGGEREDOKERROR
- last_evaluated_atstringOutput only
Timestamp of the last evaluation.
- empty_result_statestring
Alert state if result is empty. If not set, an empty result sets the state to
ERROR. Please avoid setting this field to beUNKNOWNbecauseUNKNOWNstate is planned to be deprecated.UNKNOWNTRIGGEREDOKERROR
- scheduleobject
Schedule on which the alert runs its query and evaluates the condition.
Show child attributesHide child attributes
- quartz_cron_schedulestring
A cron expression using quartz syntax that specifies the schedule for this alert. Should use the quartz format described here: http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html
- timezone_idstring
A Java timezone id. The schedule will be resolved using this timezone. This will be combined with the quartz_cron_schedule to determine the schedule. See https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html for details.
- pause_statusstring
Indicates whether this schedule is paused. While paused, the alert is not evaluated.
UNPAUSEDPAUSED
- lifecycle_statestringOutput only
Indicates whether the alert is active (
ACTIVE) or has been moved to the trash (DELETED).ACTIVEDELETED
- custom_summarystring
Custom summary for the alert, used as the notification subject. Interpreted according to
custom_template_format.
- custom_descriptionstring
Custom description for the alert, used as the notification body. Interpreted according to
custom_template_format. The available template variables are listed at https://docs.databricks.com/aws/en/sql/user/alerts/create#notification-templates.
- run_asobject
Specifies the identity that will be used to run the alert. This field allows you to configure alerts to run as a specific user or service principal.
- For user identity: Set
user_nameto the email of an active workspace user. Users can only set this to their own email. - For service principal: Set
service_principal_nameto the application ID. Requires theservicePrincipal/userrole. If not specified, the alert will run as the request user.
Show child attributesHide child attributes
- user_namestring
The email of an active workspace user. Can only set this field to their own email.
- service_principal_namestring
Application ID of an active service principal. Setting this field requires the
servicePrincipal/userrole.
- For user identity: Set
- effective_run_asobjectOutput only
The actual identity that will be used to execute the alert. This is an output-only field that shows the resolved run-as identity after applying permissions and defaults.
Show child attributesHide child attributes
- user_namestring
The email of an active workspace user. Can only set this field to their own email.
- service_principal_namestring
Application ID of an active service principal. Setting this field requires the
servicePrincipal/userrole.
- parametersarray of objectBetaUnordered list
A list of parameters to pass into the alert SQL query statement containing parameter markers. Static values only.
Reference a parameter in the query text as
:name. Each parameter must have a unique, non-empty name. Each parameter consists of a name, a value, and optionally a type. To represent a NULL value, thevaluefield may be omitted or set tonullexplicitly. If thetypefield is omitted, the value is interpreted as a string.If the type is given, parameters will be checked for type correctness according to the given type. A value is correct if the provided string can be converted to the requested type using the
castfunction. The exact semantics are described in the sectioncastfunction of the SQL language reference.Show child attributesHide child attributes
- namestringBeta
The name of the parameter. Reference it in the query text as
:name. Required, must be non-empty, and must be unique across the alert's parameters.
- valuestringBeta
The value bound to the parameter, represented as a string. If omitted, the value is interpreted as NULL.
- typestringBeta
The SQL data type of the parameter, for example
STRING,INT, orDECIMAL(10, 2). If no type is given the type is assumed to beSTRING. Complex types such asARRAY,MAP, andSTRUCTare not supported.
- custom_template_formatstringPublic Preview
The format used to interpret the
custom_summaryandcustom_descriptiontemplates.HTMLtreats both templates as HTML with Mustache{{VARIABLE_NAME}}placeholders.MARKDOWNtreats them as Markdown with allowlisted@VARIABLE_NAMEplaceholders and converts them to the format each notification destination expects, so a single template renders correctly in email, Slack, and Microsoft Teams.When unset, the API applies no default. Responses omit the field unless a format is stored, and a template with no format is rendered as HTML.
HTMLMARKDOWN
Get an alert GA
GET
Gets an alert.
API scopes: alerts
Parameters
- idstringRequiredpath
ID of the alert to retrieve, as returned in the alert's
idfield.
Response
Returns the Alert object.
List alerts GA
GET
Gets a list of alerts accessible to the user, ordered by creation time.
API scopes: alerts
Parameters
- page_tokenstringquery
Page token returned as
next_page_tokenby a previous call. Omit it to retrieve the first page.
- page_sizeint32<= 100query
Maximum number of alerts to return per page. Values above 100 are coerced to 100.
Response
Returns a list of Alert objects.
Create an alert GA
POST
Creates an alert that runs query_text on the given schedule and evaluates the result against the configured condition.
API scopes: alerts
Request body
- display_namestringRequired
The display name of the alert.
- parent_pathstring
The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated.
- query_textstringRequired
Text of the query to be run.
- warehouse_idstringRequired
ID of the SQL warehouse attached to the alert.
- run_as_user_namestringDeprecated
Deprecated: Use
run_asfield instead. This field will be removed in a future release. The run as username or application ID of service principal. On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
- evaluationobjectRequired
Condition evaluated against the query result, and who is notified when it is met.
Show child attributesHide child attributes
- sourceobjectRequired
Source column from result to use to evaluate alert
Show child attributesHide child attributes
- namestringRequired
Name of the column in the query result.
- displaystring
Label for the column in notifications. Defaults to
name.
- aggregationstring
Aggregation applied to the column across all rows of the query result:
SUM,COUNT,COUNT_DISTINCT,AVG,MEDIAN,MIN,MAXorSTDDEV. If not set, the value in the first row is used, which is equivalent to usingFirst rowin the UI.SUMCOUNTCOUNT_DISTINCTAVGMEDIANMINMAXSTDDEV
- comparison_operatorstringRequired
Operator used for comparison in alert evaluation. The alert is triggered when the comparison of the source value with the threshold is true.
IS_NULLandIS_NOT_NULLtake no threshold.LESS_THANGREATER_THANEQUALNOT_EQUALGREATER_THAN_OR_EQUALLESS_THAN_OR_EQUALIS_NULLIS_NOT_NULL
- thresholdobject
Threshold to compare the source column against, either another column or a fixed value. Not needed when
comparison_operatorisIS_NULLorIS_NOT_NULL.Show child attributesHide child attributes
- columnobject
Compare the source against another column of the query result.
Show child attributesHide child attributes
- namestringRequired
Name of the column in the query result.
- displaystring
Label for the column in notifications. Defaults to
name.
- aggregationstring
Aggregation applied to the column across all rows of the query result:
SUM,COUNT,COUNT_DISTINCT,AVG,MEDIAN,MIN,MAXorSTDDEV. If not set, the value in the first row is used, which is equivalent to usingFirst rowin the UI.SUMCOUNTCOUNT_DISTINCTAVGMEDIANMINMAXSTDDEV
- valueobject
Compare the source against a fixed value.
Show child attributesHide child attributes
- string_valuestring
String threshold, for string or timestamp columns.
- double_valuedouble
Numeric threshold, for numeric columns.
- bool_valueboolean
Boolean threshold, for boolean columns.
- notificationobject
User or Notification Destination to notify when alert is triggered.
Show child attributesHide child attributes
- subscriptionsarray of objectUnordered list
Users and notification destinations that receive notifications.
Show child attributesHide child attributes
- user_emailstring
Email address of the workspace user to notify.
- destination_idstring
ID of the notification destination to notify, as returned by the Notification Destinations API.
- retrigger_secondsint32
Number of seconds an alert waits after being triggered before it is allowed to send another notification. If set to 0 or omitted, the alert will not send any further notifications after the first trigger Setting this value to 1 allows the alert to send a notification on every evaluation where the condition is met, effectively making it always retrigger for notification purposes.
- notify_on_okboolean
Whether to notify alert subscribers when alert returns back to normal.
- empty_result_statestring
Alert state if result is empty. If not set, an empty result sets the state to
ERROR. Please avoid setting this field to beUNKNOWNbecauseUNKNOWNstate is planned to be deprecated.UNKNOWNTRIGGEREDOKERROR
- scheduleobjectRequired
Schedule on which the alert runs its query and evaluates the condition.
Show child attributesHide child attributes
- quartz_cron_schedulestringRequired
A cron expression using quartz syntax that specifies the schedule for this alert. Should use the quartz format described here: http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html
- timezone_idstringRequired
A Java timezone id. The schedule will be resolved using this timezone. This will be combined with the quartz_cron_schedule to determine the schedule. See https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html for details.
- pause_statusstring
Indicates whether this schedule is paused. While paused, the alert is not evaluated.
UNPAUSEDPAUSED
- custom_summarystring
Custom summary for the alert, used as the notification subject. Interpreted according to
custom_template_format.
- custom_descriptionstring
Custom description for the alert, used as the notification body. Interpreted according to
custom_template_format. The available template variables are listed at https://docs.databricks.com/aws/en/sql/user/alerts/create#notification-templates.
- run_asobject
Specifies the identity that will be used to run the alert. This field allows you to configure alerts to run as a specific user or service principal.
- For user identity: Set
user_nameto the email of an active workspace user. Users can only set this to their own email. - For service principal: Set
service_principal_nameto the application ID. Requires theservicePrincipal/userrole. If not specified, the alert will run as the request user.
Show child attributesHide child attributes
- user_namestring
The email of an active workspace user. Can only set this field to their own email.
- service_principal_namestring
Application ID of an active service principal. Setting this field requires the
servicePrincipal/userrole.
- For user identity: Set
- parametersarray of objectBetaUnordered list
A list of parameters to pass into the alert SQL query statement containing parameter markers. Static values only.
Reference a parameter in the query text as
:name. Each parameter must have a unique, non-empty name. Each parameter consists of a name, a value, and optionally a type. To represent a NULL value, thevaluefield may be omitted or set tonullexplicitly. If thetypefield is omitted, the value is interpreted as a string.If the type is given, parameters will be checked for type correctness according to the given type. A value is correct if the provided string can be converted to the requested type using the
castfunction. The exact semantics are described in the sectioncastfunction of the SQL language reference.Show child attributesHide child attributes
- namestringRequiredBeta
The name of the parameter. Reference it in the query text as
:name. Required, must be non-empty, and must be unique across the alert's parameters.
- valuestringBeta
The value bound to the parameter, represented as a string. If omitted, the value is interpreted as NULL.
- typestringBeta
The SQL data type of the parameter, for example
STRING,INT, orDECIMAL(10, 2). If no type is given the type is assumed to beSTRING. Complex types such asARRAY,MAP, andSTRUCTare not supported.
- custom_template_formatstringPublic Preview
The format used to interpret the
custom_summaryandcustom_descriptiontemplates.HTMLtreats both templates as HTML with Mustache{{VARIABLE_NAME}}placeholders.MARKDOWNtreats them as Markdown with allowlisted@VARIABLE_NAMEplaceholders and converts them to the format each notification destination expects, so a single template renders correctly in email, Slack, and Microsoft Teams.When unset, the API applies no default. Responses omit the field unless a format is stored, and a template with no format is rendered as HTML.
HTMLMARKDOWN
Response
Returns the Alert object.
Update an alert GA
PATCH
Updates an alert. Only the fields listed in update_mask are changed; all other fields keep their current values.
API scopes: alerts
Parameters
- idstringRequiredIDImmutablepath
The canonical identifier of the alert to retrieve information about.
- update_maskstringRequiredquery
Comma-separated list of the alert fields to update, for example
display_name,query_textorschedule.pause_status. Only the listed fields are changed; all other fields keep their current values.parent_pathcannot be updated.
Request body
- display_namestringRequired
The display name of the alert.
- parent_pathstring
The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated.
- query_textstringRequired
Text of the query to be run.
- warehouse_idstringRequired
ID of the SQL warehouse attached to the alert.
- run_as_user_namestringDeprecated
Deprecated: Use
run_asfield instead. This field will be removed in a future release. The run as username or application ID of service principal. On Create and Update, this field can be set to application ID of an active service principal. Setting this field requires the servicePrincipal/user role.
- evaluationobjectRequired
Condition evaluated against the query result, and who is notified when it is met.
Show child attributesHide child attributes
- sourceobjectRequired
Source column from result to use to evaluate alert
Show child attributesHide child attributes
- namestringRequired
Name of the column in the query result.
- displaystring
Label for the column in notifications. Defaults to
name.
- aggregationstring
Aggregation applied to the column across all rows of the query result:
SUM,COUNT,COUNT_DISTINCT,AVG,MEDIAN,MIN,MAXorSTDDEV. If not set, the value in the first row is used, which is equivalent to usingFirst rowin the UI.SUMCOUNTCOUNT_DISTINCTAVGMEDIANMINMAXSTDDEV
- comparison_operatorstringRequired
Operator used for comparison in alert evaluation. The alert is triggered when the comparison of the source value with the threshold is true.
IS_NULLandIS_NOT_NULLtake no threshold.LESS_THANGREATER_THANEQUALNOT_EQUALGREATER_THAN_OR_EQUALLESS_THAN_OR_EQUALIS_NULLIS_NOT_NULL
- thresholdobject
Threshold to compare the source column against, either another column or a fixed value. Not needed when
comparison_operatorisIS_NULLorIS_NOT_NULL.Show child attributesHide child attributes
- columnobject
Compare the source against another column of the query result.
Show child attributesHide child attributes
- namestringRequired
Name of the column in the query result.
- displaystring
Label for the column in notifications. Defaults to
name.
- aggregationstring
Aggregation applied to the column across all rows of the query result:
SUM,COUNT,COUNT_DISTINCT,AVG,MEDIAN,MIN,MAXorSTDDEV. If not set, the value in the first row is used, which is equivalent to usingFirst rowin the UI.SUMCOUNTCOUNT_DISTINCTAVGMEDIANMINMAXSTDDEV
- valueobject
Compare the source against a fixed value.
Show child attributesHide child attributes
- string_valuestring
String threshold, for string or timestamp columns.
- double_valuedouble
Numeric threshold, for numeric columns.
- bool_valueboolean
Boolean threshold, for boolean columns.
- notificationobject
User or Notification Destination to notify when alert is triggered.
Show child attributesHide child attributes
- subscriptionsarray of objectUnordered list
Users and notification destinations that receive notifications.
Show child attributesHide child attributes
- user_emailstring
Email address of the workspace user to notify.
- destination_idstring
ID of the notification destination to notify, as returned by the Notification Destinations API.
- retrigger_secondsint32
Number of seconds an alert waits after being triggered before it is allowed to send another notification. If set to 0 or omitted, the alert will not send any further notifications after the first trigger Setting this value to 1 allows the alert to send a notification on every evaluation where the condition is met, effectively making it always retrigger for notification purposes.
- notify_on_okboolean
Whether to notify alert subscribers when alert returns back to normal.
- empty_result_statestring
Alert state if result is empty. If not set, an empty result sets the state to
ERROR. Please avoid setting this field to beUNKNOWNbecauseUNKNOWNstate is planned to be deprecated.UNKNOWNTRIGGEREDOKERROR
- scheduleobjectRequired
Schedule on which the alert runs its query and evaluates the condition.
Show child attributesHide child attributes
- quartz_cron_schedulestringRequired
A cron expression using quartz syntax that specifies the schedule for this alert. Should use the quartz format described here: http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html
- timezone_idstringRequired
A Java timezone id. The schedule will be resolved using this timezone. This will be combined with the quartz_cron_schedule to determine the schedule. See https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html for details.
- pause_statusstring
Indicates whether this schedule is paused. While paused, the alert is not evaluated.
UNPAUSEDPAUSED
- custom_summarystring
Custom summary for the alert, used as the notification subject. Interpreted according to
custom_template_format.
- custom_descriptionstring
Custom description for the alert, used as the notification body. Interpreted according to
custom_template_format. The available template variables are listed at https://docs.databricks.com/aws/en/sql/user/alerts/create#notification-templates.
- run_asobject
Specifies the identity that will be used to run the alert. This field allows you to configure alerts to run as a specific user or service principal.
- For user identity: Set
user_nameto the email of an active workspace user. Users can only set this to their own email. - For service principal: Set
service_principal_nameto the application ID. Requires theservicePrincipal/userrole. If not specified, the alert will run as the request user.
Show child attributesHide child attributes
- user_namestring
The email of an active workspace user. Can only set this field to their own email.
- service_principal_namestring
Application ID of an active service principal. Setting this field requires the
servicePrincipal/userrole.
- For user identity: Set
- parametersarray of objectBetaUnordered list
A list of parameters to pass into the alert SQL query statement containing parameter markers. Static values only.
Reference a parameter in the query text as
:name. Each parameter must have a unique, non-empty name. Each parameter consists of a name, a value, and optionally a type. To represent a NULL value, thevaluefield may be omitted or set tonullexplicitly. If thetypefield is omitted, the value is interpreted as a string.If the type is given, parameters will be checked for type correctness according to the given type. A value is correct if the provided string can be converted to the requested type using the
castfunction. The exact semantics are described in the sectioncastfunction of the SQL language reference.Show child attributesHide child attributes
- namestringRequiredBeta
The name of the parameter. Reference it in the query text as
:name. Required, must be non-empty, and must be unique across the alert's parameters.
- valuestringBeta
The value bound to the parameter, represented as a string. If omitted, the value is interpreted as NULL.
- typestringBeta
The SQL data type of the parameter, for example
STRING,INT, orDECIMAL(10, 2). If no type is given the type is assumed to beSTRING. Complex types such asARRAY,MAP, andSTRUCTare not supported.
- custom_template_formatstringPublic Preview
The format used to interpret the
custom_summaryandcustom_descriptiontemplates.HTMLtreats both templates as HTML with Mustache{{VARIABLE_NAME}}placeholders.MARKDOWNtreats them as Markdown with allowlisted@VARIABLE_NAMEplaceholders and converts them to the format each notification destination expects, so a single template renders correctly in email, Slack, and Microsoft Teams.When unset, the API applies no default. Responses omit the field unless a format is stored, and a template with no format is rendered as HTML.
HTMLMARKDOWN
Response
Returns the Alert object.
Delete an alert (legacy TrashAlert) GA
DELETE
Moves an alert to the trash. Trashed alerts immediately disappear from 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: alerts
Parameters
- idstringRequiredpath
ID of the alert to move to the trash.