Skip to main content

alerts

Operations on a alerts resource.

Overview

Namealerts
TypeResource
Iddatabricks_workspace.dbsql.alerts

Fields

NameDatatype
idstring
conditionobject
create_timestring
display_namestring
lifecycle_statestring
owner_user_namestring
parent_pathstring
query_idstring
seconds_to_retriggerinteger
statestring
update_timestring

Methods

NameAccessible byRequired ParamsDescription
getSELECTid, deployment_nameGets an alert.
listSELECTdeployment_nameGets a list of alerts accessible to the user, ordered by creation time.
createINSERTdeployment_nameCreates an alert.
deleteDELETEid, deployment_nameMoves an alert to the trash. Trashed alerts immediately disappear from searches and list views, and can no longer trigger. You can restore a trashed alert through the UI. A trashed alert is permanently deleted after 30 days.
updateUPDATEid, deployment_nameUpdates an alert.

SELECT examples

SELECT
id,
condition,
create_time,
display_name,
lifecycle_state,
owner_user_name,
parent_path,
query_id,
seconds_to_retrigger,
state,
update_time
FROM databricks_workspace.dbsql.alerts
WHERE deployment_name = '{{ deployment_name }}';

INSERT example

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

/*+ create */
INSERT INTO databricks_workspace.dbsql.alerts (
deployment_name,
data__alert
)
SELECT
'{{ deployment_name }}',
'{{ alert }}'
;

UPDATE example

Updates a alerts resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.dbsql.alerts
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE id = '{{ id }}' AND
deployment_name = '{{ deployment_name }}';

DELETE example

Deletes a alerts resource.

/*+ delete */
DELETE FROM databricks_workspace.dbsql.alerts
WHERE id = '{{ id }}' AND
deployment_name = '{{ deployment_name }}';