Alerts

Package: databricks.bundles.alerts

Classes

class Aggregation
SUM = 'SUM'
COUNT = 'COUNT'
COUNT_DISTINCT = 'COUNT_DISTINCT'
AVG = 'AVG'
MEDIAN = 'MEDIAN'
MIN = 'MIN'
MAX = 'MAX'
STDDEV = 'STDDEV'
class 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.

display_name: str

The display name of the alert.

evaluation: AlertV2Evaluation

Condition evaluated against the query result, and who is notified when it is met.

query_text: str

Text of the query to be run.

schedule: CronSchedule

Schedule on which the alert runs its query and evaluates the condition.

warehouse_id: str

ID of the SQL warehouse attached to the alert.

custom_description: str | None = None

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.

custom_summary: str | None = None

Custom summary for the alert, used as the notification subject. Interpreted according to custom_template_format.

custom_template_format: CustomTemplateFormat | None = None

[Public Preview] The format used to interpret the custom_summary and custom_description templates.

HTML treats both templates as HTML with Mustache {{VARIABLE_NAME}} placeholders. MARKDOWN treats them as Markdown with allowlisted @VARIABLE_NAME placeholders 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.

file_path: str | None = None
lifecycle: Lifecycle | None = None

Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed.

parent_path: str | None = None

The workspace path of the folder containing the alert. Can only be set on create, and cannot be updated.

permissions: list[Permission]

The permissions to apply to this resource.

run_as: AlertV2RunAs | None = None

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_name to the email of an active workspace user. Users can only set this to their own email. - For service principal: Set service_principal_name to the application ID. Requires the servicePrincipal/user role. If not specified, the alert will run as the request user.

run_as_user_name: str | None = None

[DEPRECATED] Deprecated: Use run_as field 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.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertEvaluationState

UNSPECIFIED - default unspecify value for proto enum, do not use it in the code UNKNOWN - alert not yet evaluated TRIGGERED - alert is triggered OK - alert is not triggered ERROR - alert evaluation failed

UNKNOWN = 'UNKNOWN'
TRIGGERED = 'TRIGGERED'
OK = 'OK'
ERROR = 'ERROR'
class AlertStatementParameter

A named parameter bound to the alert query. Only flat, named scalar parameters are supported; complex types such as ARRAY, MAP, and STRUCT are not.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2Evaluation
comparison_operator: ComparisonOperator

Operator used for comparison in alert evaluation. The alert is triggered when the comparison of the source value with the threshold is true. IS_NULL and IS_NOT_NULL take no threshold.

source: AlertV2OperandColumn

Source column from result to use to evaluate alert

empty_result_state: AlertEvaluationState | None = None

Alert state if result is empty. If not set, an empty result sets the state to ERROR. Please avoid setting this field to be UNKNOWN because UNKNOWN state is planned to be deprecated.

notification: AlertV2Notification | None = None

User or Notification Destination to notify when alert is triggered.

threshold: AlertV2Operand | None = None

Threshold to compare the source column against, either another column or a fixed value. Not needed when comparison_operator is IS_NULL or IS_NOT_NULL.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2Notification
notify_on_ok: bool | None = None

Whether to notify alert subscribers when alert returns back to normal.

retrigger_seconds: int | None = None

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.

subscriptions: list[AlertV2Subscription]

Users and notification destinations that receive notifications.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2Operand
column: AlertV2OperandColumn | None = None

Compare the source against another column of the query result.

value: AlertV2OperandValue | None = None

Compare the source against a fixed value.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2OperandColumn
name: str

Name of the column in the query result.

aggregation: Aggregation | None = None

Aggregation applied to the column across all rows of the query result: SUM, COUNT, COUNT_DISTINCT, AVG, MEDIAN, MIN, MAX or STDDEV. If not set, the value in the first row is used, which is equivalent to using First row in the UI.

display: str | None = None

Label for the column in notifications. Defaults to name.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2OperandValue
bool_value: bool | None = None

Boolean threshold, for boolean columns.

double_value: float | None = None

Numeric threshold, for numeric columns.

string_value: str | None = None

String threshold, for string or timestamp columns.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2RunAs
service_principal_name: str | None = None

Application ID of an active service principal. Setting this field requires the servicePrincipal/user role.

user_name: str | None = None

The email of an active workspace user. Can only set this field to their own email.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class AlertV2Subscription
destination_id: str | None = None

ID of the notification destination to notify, as returned by the Notification Destinations API.

user_email: str | None = None

Email address of the workspace user to notify.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class ComparisonOperator
LESS_THAN = 'LESS_THAN'
GREATER_THAN = 'GREATER_THAN'
EQUAL = 'EQUAL'
NOT_EQUAL = 'NOT_EQUAL'
GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL'
LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL'
IS_NULL = 'IS_NULL'
IS_NOT_NULL = 'IS_NOT_NULL'
class CronSchedule
quartz_cron_schedule: str

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_id: str

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_status: SchedulePauseStatus | None = None

Indicates whether this schedule is paused. While paused, the alert is not evaluated.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class CustomTemplateFormat

Rendering format for the custom_summary and custom_description templates.

HTML = 'HTML'
MARKDOWN = 'MARKDOWN'
class DependsOn
resource: str

Key of the resource to depend on, as foo or jobs.foo, or of its grants or permissions, as schemas.foo.grants.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class Lifecycle
depends_on: list[DependsOn]

Resources that must be deployed before this resource and deleted after it. Unlike variable references, this only affects ordering.

prevent_destroy: bool | None = None

Lifecycle setting to prevent the resource from being destroyed.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class Permission
level: PermissionLevel

The permission level to apply. The allowed levels depend on the resource type.

group_name: str | None = None

The name of the group granted the permission level.

service_principal_name: str | None = None

The name of the service principal granted the permission level.

user_name: str | None = None

The name of the user granted the permission level.

classmethod from_dict(
value: dict,
) → Self
as_dict(
self,
) → dict
class PermissionLevel

Permission level

CAN_MANAGE = 'CAN_MANAGE'
CAN_RESTART = 'CAN_RESTART'
CAN_ATTACH_TO = 'CAN_ATTACH_TO'
IS_OWNER = 'IS_OWNER'
CAN_MANAGE_RUN = 'CAN_MANAGE_RUN'
CAN_VIEW = 'CAN_VIEW'
CAN_READ = 'CAN_READ'
CAN_RUN = 'CAN_RUN'
CAN_EDIT = 'CAN_EDIT'
CAN_USE = 'CAN_USE'
CAN_MANAGE_STAGING_VERSIONS = 'CAN_MANAGE_STAGING_VERSIONS'
CAN_MANAGE_PRODUCTION_VERSIONS = 'CAN_MANAGE_PRODUCTION_VERSIONS'
CAN_EDIT_METADATA = 'CAN_EDIT_METADATA'
CAN_VIEW_METADATA = 'CAN_VIEW_METADATA'
CAN_BIND = 'CAN_BIND'
CAN_QUERY = 'CAN_QUERY'
CAN_MONITOR = 'CAN_MONITOR'
CAN_CREATE = 'CAN_CREATE'
CAN_MONITOR_ONLY = 'CAN_MONITOR_ONLY'
CAN_CREATE_APP = 'CAN_CREATE_APP'
class SchedulePauseStatus
UNPAUSED = 'UNPAUSED'
PAUSED = 'PAUSED'