Skip to main content

alerts_legacy

Operations on a alerts_legacy resource.

Overview

Namealerts_legacy
TypeResource
Iddatabricks_workspace.dbsql.alerts_legacy

Fields

NameDatatype
idstring
namestring
created_atstring
last_triggered_atstring
optionsobject
parentstring
queryobject
rearminteger
statestring
updated_atstring
userobject

Methods

NameAccessible byRequired ParamsDescription
getSELECTalert_id, deployment_nameGets an alert.
listSELECTdeployment_nameGets a list of alerts.
createINSERTdeployment_nameCreates 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.
deleteDELETEalert_id, deployment_nameDeletes an alert. Deleted alerts are no longer accessible and cannot be restored.
updateUPDATEalert_id, deployment_nameUpdates an alert.

SELECT examples

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 }}';

INSERT example

Use the following StackQL query and manifest file to create a new alerts_legacy resource.

/*+ 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 }}'
;

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 }}';