Skip to content

Alert

laktory.models.resources.databricks.Alert ¤

Bases: AlertBase

Databricks SQL Alert

Examples:

import io

from laktory import models

alert_yaml = '''
display_name: high-stock-price
parent_path: /alerts
query_id: ${resources.query-stock-prices.id}
condition:
  op: GREATER_THAN
  operand:
    column:
      name: close
  threshold:
    value:
      double_value: 500.0
access_controls:
- group_name: account users
  permission_level: CAN_VIEW
'''
alert = models.resources.databricks.Alert.model_validate_yaml(
    io.StringIO(alert_yaml)
)
References
BASE DESCRIPTION
condition

Trigger conditions of the alert. Block consists of the following attributes:

TYPE: AlertCondition | None | VariableType DEFAULT: None

custom_body

Custom body of alert notification, if it exists. See Alerts API reference for custom templating instructions

TYPE: str | None | VariableType DEFAULT: None

custom_subject

Custom subject of alert notification, if it exists. This includes email subject, Slack notification header, etc. See Alerts API reference for custom templating instructions

TYPE: str | None | VariableType DEFAULT: None

display_name

Name of the alert

TYPE: str | VariableType

notify_on_ok

Whether to notify alert subscribers when alert returns back to normal

TYPE: bool | None | VariableType DEFAULT: None

owner_user_name

Alert owner's username

TYPE: str | None | VariableType DEFAULT: None

query_id

ID of the query evaluated by the alert

TYPE: str | VariableType

seconds_to_retrigger

Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it can be triggered again. If 0 or not specified, the alert will not be triggered again

TYPE: int | None | VariableType DEFAULT: None

LAKTORY DESCRIPTION
access_controls

SQL Alert access controls

TYPE: list[AccessControl | VariableType] | VariableType DEFAULT: []

name_prefix

Prefix added to the alert display name

TYPE: str | VariableType DEFAULT: None

name_suffix

Suffix added to the alert display name

TYPE: str | VariableType DEFAULT: None

parent_path_

The path to a workspace folder (inside laktory root) containing the alert. If changed, the query will be recreated.

TYPE: str | None | VariableType DEFAULT: None

ATTRIBUTE DESCRIPTION
additional_core_resources
  • permissions

TYPE: list

additional_core_resources property ¤

  • permissions

laktory.models.resources.databricks.alert.AlertCondition ¤

Bases: BaseModel

PARAMETER DESCRIPTION
empty_result_state

Alert state if the result is empty (UNKNOWN, OK, TRIGGERED)

TYPE: str | None | VariableType DEFAULT: None

op

Operator used for comparison in alert evaluation. (Enum: GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, EQUAL, NOT_EQUAL, IS_NULL)

TYPE: str | VariableType

operand

Name of the column from the query result to use for comparison in alert evaluation:

TYPE: AlertConditionOperand | None | VariableType DEFAULT: None

threshold

Threshold value used for comparison in alert evaluation:

TYPE: AlertConditionThreshold | None | VariableType DEFAULT: None


laktory.models.resources.databricks.alert.AlertConditionOperand ¤

Bases: BaseModel

PARAMETER DESCRIPTION
column

Block describing the column from the query result to use for comparison in alert evaluation:

TYPE: AlertConditionOperandColumn | None | VariableType DEFAULT: None


laktory.models.resources.databricks.alert.AlertConditionOperandColumn ¤

Bases: BaseModel

PARAMETER DESCRIPTION
name

Name of the column

TYPE: str | VariableType


laktory.models.resources.databricks.alert.AlertConditionThreshold ¤

Bases: BaseModel

PARAMETER DESCRIPTION
value

actual value used in comparison (one of the attributes is required):

TYPE: AlertConditionThresholdValue | None | VariableType DEFAULT: None


laktory.models.resources.databricks.alert.AlertConditionThresholdValue ¤

Bases: BaseModel

PARAMETER DESCRIPTION
bool_value

boolean value (true or false) to compare against boolean results

TYPE: bool | None | VariableType DEFAULT: None

double_value

double value to compare against integer and double results

TYPE: float | None | VariableType DEFAULT: None

string_value

string value to compare against string results

TYPE: str | None | VariableType DEFAULT: None