alerts
Operations on a alerts
resource.
Overview
Name | alerts |
Type | Resource |
Id | databricks_workspace.dbsql.alerts |
Fields
Name | Datatype |
---|---|
id | string |
condition | object |
create_time | string |
display_name | string |
lifecycle_state | string |
owner_user_name | string |
parent_path | string |
query_id | string |
seconds_to_retrigger | integer |
state | string |
update_time | string |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | id, deployment_name | Gets an alert. |
list | SELECT | deployment_name | Gets a list of alerts accessible to the user, ordered by creation time. |
create | INSERT | deployment_name | Creates an alert. |
delete | DELETE | id, deployment_name | Moves 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. |
update | UPDATE | id, deployment_name | Updates an alert. |
SELECT
examples
- alerts (list)
- alerts (get)
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 }}';
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 id = '{{ id }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new alerts
resource.
- alerts
- Manifest
/*+ create */
INSERT INTO databricks_workspace.dbsql.alerts (
deployment_name,
data__alert
)
SELECT
'{{ deployment_name }}',
'{{ alert }}'
;
- name: your_resource_model_name
props:
- name: alert
value:
seconds_to_retrigger: 0
display_name: Test alert
condition:
op: GREATER_THAN
operand:
column:
name: foo
threshold:
value:
double_value: 1
query_id: dee5cca8-1c79-4b5e-a71m1-e7f9d241bdf6
parent_path: /Workspace/Users/user.name@acme.com
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 }}';