alerts_legacy
Operations on a alerts_legacy
resource.
Overview
Name | alerts_legacy |
Type | Resource |
Id | databricks_workspace.dbsql.alerts_legacy |
Fields
Name | Datatype |
---|---|
id | string |
name | string |
created_at | string |
last_triggered_at | string |
options | object |
parent | string |
query | object |
rearm | integer |
state | string |
updated_at | string |
user | object |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | alert_id, deployment_name | Gets an alert. |
list | SELECT | deployment_name | Gets a list of alerts. |
create | INSERT | deployment_name | Creates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a condition of its result, and notifies users or notification destinations if the condition was met. |
delete | DELETE | alert_id, deployment_name | Deletes an alert. Deleted alerts are no longer accessible and cannot be restored. |
update | UPDATE | alert_id, deployment_name | Updates an alert. |
SELECT
examples
- alerts_legacy (list)
- alerts_legacy (get)
SELECT
id,
name,
created_at,
last_triggered_at,
options,
parent,
query,
rearm,
state,
updated_at,
user
FROM databricks_workspace.dbsql.alerts_legacy
WHERE deployment_name = '{{ deployment_name }}';
SELECT
id,
name,
created_at,
last_triggered_at,
options,
parent,
query,
rearm,
state,
updated_at,
user
FROM databricks_workspace.dbsql.alerts_legacy
WHERE alert_id = '{{ alert_id }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new alerts_legacy
resource.
- alerts_legacy
- Manifest
/*+ create */
INSERT INTO databricks_workspace.dbsql.alerts_legacy (
deployment_name,
data__name,
data__options,
data__query_id,
data__rearm,
data__parent
)
SELECT
'{{ deployment_name }}',
'{{ name }}',
'{{ options }}',
'{{ query_id }}',
'{{ rearm }}',
'{{ parent }}'
;
- name: your_resource_model_name
props:
- name: name
value: Total Trips > 300
- name: options
value:
column: total_trips
custom_body: Total trips exceeded
custom_subject: The total trips has exceeded 300.
muted: false
op: '>'
value: null
empty_result_state: unknown
- name: query_id
value: dee5cca8-1c79-4b5e-a711-e7f9d241bdf6
- name: rearm
value: 0
- name: parent
value: folders/2025532471912059
UPDATE
example
Updates a alerts_legacy
resource.
/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.dbsql.alerts_legacy
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE alert_id = '{{ alert_id }}' AND
deployment_name = '{{ deployment_name }}';
DELETE
example
Deletes a alerts_legacy
resource.
/*+ delete */
DELETE FROM databricks_workspace.dbsql.alerts_legacy
WHERE alert_id = '{{ alert_id }}' AND
deployment_name = '{{ deployment_name }}';