AlertV2
laktory.models.resources.databricks.AlertV2
¤
Bases: AlertV2Base
Databricks SQL Alert (v2)
Scheduled SQL alert evaluating its own query text, with notifications sent
when a condition is met. Latest version of the SQL alerts API; Alert
manages alerts of the previous API.
Examples:
import io
from laktory import models
alert_yaml = '''
display_name: high-stock-price
parent_path: /alerts
warehouse_id: a7d9f2kl8mp3q6rt
query_text: SELECT MAX(close) AS max_close FROM dev.finance.slv_stock_prices
evaluation:
comparison_operator: GREATER_THAN
source:
name: max_close
threshold:
value:
double_value: 500.0
notification:
subscriptions:
- user_email: finance-alerts@okube.ai
schedule:
quartz_cron_schedule: 0 0 8 * * ?
timezone_id: America/Montreal
access_controls:
- group_name: account users
permission_level: CAN_READ
'''
alert = models.resources.databricks.AlertV2.model_validate_yaml(
io.StringIO(alert_yaml)
)
print(alert.parent_path)
# > /Workspace/.laktory/alerts
| BASE | DESCRIPTION |
|---|---|
custom_description
|
Custom description for the alert. support mustache template
TYPE:
|
custom_summary
|
Custom summary for the alert. support mustache template
TYPE:
|
display_name
|
The display name of the alert *
TYPE:
|
evaluation
|
TYPE:
|
parameters
|
A list of parameters to pass into the alert SQL query statement containing parameter markers. Static values only
TYPE:
|
provider_config
|
Configure the provider for management through account provider
TYPE:
|
purge_on_delete
|
Whether to permanently delete the alert. If not set, the alert will only be soft deleted
TYPE:
|
query_text
|
Text of the query to be run *
TYPE:
|
run_as
|
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
TYPE:
|
run_as_user_name
|
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. Deprecated: Use
TYPE:
|
schedule
|
TYPE:
|
warehouse_id
|
ID of the SQL warehouse attached to the alert
TYPE:
|
| LAKTORY | DESCRIPTION |
|---|---|
access_controls
|
SQL Alert access controls
TYPE:
|
name_prefix
|
Prefix added to the alert display name
TYPE:
|
name_suffix
|
Suffix added to the alert display name
TYPE:
|
parent_path_
|
The path to a workspace folder (inside laktory root) containing the alert. If changed, the alert will be
recreated. The folder must exist, e.g. created by a
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
additional_core_resources |
TYPE:
|
additional_core_resources
property
¤
- permissions
laktory.models.resources.databricks.alertv2.AlertV2Evaluation
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
comparison_operator
|
Operator used for comparison in alert evaluation. Possible values are:
TYPE:
|
empty_result_state
|
Alert state if result is empty. Please avoid setting this field to be
TYPE:
|
notification
|
User or Notification Destination to notify when alert is triggered
TYPE:
|
source
|
Source column from result to use to evaluate alert
TYPE:
|
threshold
|
Threshold to user for alert evaluation, can be a column or a value
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2EvaluationNotification
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
notify_on_ok
|
Whether to notify alert subscribers when alert returns back to normal
TYPE:
|
retrigger_seconds
|
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 *
TYPE:
|
subscriptions
|
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2EvaluationNotificationSubscriptions
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
destination_id
|
TYPE:
|
user_email
|
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2EvaluationSource
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
aggregation
|
If not set, the behavior is equivalent to using
TYPE:
|
display
|
TYPE:
|
name
|
The name of the parameter. Reference it in the query text as
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2EvaluationThreshold
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
column
|
TYPE:
|
value
|
The value bound to the parameter, represented as a string. If omitted, the value is interpreted as NULL
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2EvaluationThresholdColumn
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
aggregation
|
If not set, the behavior is equivalent to using
TYPE:
|
display
|
TYPE:
|
name
|
The name of the parameter. Reference it in the query text as
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2EvaluationThresholdValue
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
bool_value
|
TYPE:
|
double_value
|
TYPE:
|
string_value
|
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2Parameters
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the parameter. Reference it in the query text as
TYPE:
|
type
|
The SQL data type of the parameter, for example
TYPE:
|
value
|
The value bound to the parameter, represented as a string. If omitted, the value is interpreted as NULL
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2ProviderConfig
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
workspace_id
|
Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2RunAs
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
service_principal_name
|
Application ID of an active service principal. Setting this field requires the
TYPE:
|
user_name
|
The email of an active workspace user. Can only set this field to their own email
TYPE:
|
laktory.models.resources.databricks.alertv2.AlertV2Schedule
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
pause_status
|
Indicate whether this schedule is paused or not. Possible values are:
TYPE:
|
quartz_cron_schedule
|
A cron expression using quartz syntax that specifies the schedule for this pipeline. Should use the quartz format described here: http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html
TYPE:
|
timezone_id
|
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
TYPE:
|