Skip to main content

alerts_legacy

Creates, updates, deletes, gets or lists an alerts_legacy resource.

Overview

Namealerts_legacy
TypeResource
Iddatabricks_workspace.sql.alerts_legacy

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringAlert ID.
namestringName of the alert.
created_atstring
last_triggered_atstringTimestamp when the alert was last triggered.
optionsobjectAlert configuration options.
parentstringThe identifier of the workspace folder containing the object.
queryobject
rearmintegerNumber of seconds after being triggered before the alert rearms itself and can be triggered again. If `null`, alert will never be triggered again.
statestringState of the alert. Possible values are: `unknown` (yet to be evaluated), `triggered` (evaluated and fulfilled trigger conditions), or `ok` (evaluated and did not fulfill trigger conditions). (ok, triggered, unknown)
updated_atstringTimestamp when the alert was last updated.
userobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectalert_id, deployment_nameGets an alert.
listselectdeployment_nameGets a list of alerts.
createinsertdeployment_name, name, options, query_idCreates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a
updatereplacealert_id, deployment_name, name, options, query_idUpdates an alert.
deletedeletealert_id, deployment_nameDeletes an alert. Deleted alerts are no longer accessible and cannot be restored. Note: Unlike

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
alert_idstringstr
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)

SELECT examples

Gets an alert.

SELECT
id,
name,
created_at,
last_triggered_at,
options,
parent,
query,
rearm,
state,
updated_at,
user
FROM databricks_workspace.sql.alerts_legacy
WHERE alert_id = '{{ alert_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Creates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a

INSERT INTO databricks_workspace.sql.alerts_legacy (
name,
options,
query_id,
parent,
rearm,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ options }}' /* required */,
'{{ query_id }}' /* required */,
'{{ parent }}',
{{ rearm }},
'{{ deployment_name }}'
RETURNING
id,
name,
created_at,
last_triggered_at,
options,
parent,
query,
rearm,
state,
updated_at,
user
;

REPLACE examples

Updates an alert.

REPLACE databricks_workspace.sql.alerts_legacy
SET
name = '{{ name }}',
options = '{{ options }}',
query_id = '{{ query_id }}',
rearm = {{ rearm }}
WHERE
alert_id = '{{ alert_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND name = '{{ name }}' --required
AND options = '{{ options }}' --required
AND query_id = '{{ query_id }}' --required;

DELETE examples

Deletes an alert. Deleted alerts are no longer accessible and cannot be restored. Note: Unlike

DELETE FROM databricks_workspace.sql.alerts_legacy
WHERE alert_id = '{{ alert_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;