alerts
Creates, updates, deletes, gets or lists an alerts resource.
Overview
| Name | alerts |
| Type | Resource |
| Id | databricks_workspace.sql.alerts |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | UUID identifying the alert. |
query_id | string | UUID of the query attached to the alert. |
display_name | string | The display name of the alert. |
owner_user_name | string | The owner's username. This field is set to "Unavailable" if the user has been deleted. |
condition | object | |
create_time | string | The timestamp indicating when the alert was created. |
custom_body | string | Custom body of alert notification, if it exists. See [here] for custom templating instructions. [here]: https://docs.databricks.com/sql/user/alerts/index.html |
custom_subject | string | Custom subject of alert notification, if it exists. This can include email subject entries and Slack notification headers, for example. See [here] for custom templating instructions. [here]: https://docs.databricks.com/sql/user/alerts/index.html |
lifecycle_state | string | The workspace state of the alert. Used for tracking trashed status. (ACTIVE, TRASHED) |
notify_on_ok | boolean | Whether to notify alert subscribers when alert returns back to normal. |
parent_path | string | The workspace path of the folder containing the alert. |
seconds_to_retrigger | integer | Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it can be triggered again. If 0 or not specified, the alert will not be triggered again. |
state | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />>>> Color.RED<br /><Color.RED: 1><br /><br />- value lookup:<br /><br />>>> Color(1)<br /><Color.RED: 1><br /><br />- name lookup:<br /><br />>>> Color['RED']<br /><Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (OK, TRIGGERED, UNKNOWN) |
trigger_time | string | Timestamp when the alert was last triggered, if the alert has been triggered before. |
update_time | string | The timestamp indicating when the alert was updated. |
| Name | Datatype | Description |
|---|---|---|
id | string | UUID identifying the alert. |
query_id | string | UUID of the query attached to the alert. |
display_name | string | The display name of the alert. |
owner_user_name | string | The owner's username. This field is set to "Unavailable" if the user has been deleted. |
condition | object | |
create_time | string | The timestamp indicating when the alert was created. |
custom_body | string | Custom body of alert notification, if it exists. See [here] for custom templating instructions. [here]: https://docs.databricks.com/sql/user/alerts/index.html |
custom_subject | string | Custom subject of alert notification, if it exists. This can include email subject entries and Slack notification headers, for example. See [here] for custom templating instructions. [here]: https://docs.databricks.com/sql/user/alerts/index.html |
lifecycle_state | string | The workspace state of the alert. Used for tracking trashed status. (ACTIVE, TRASHED) |
notify_on_ok | boolean | Whether to notify alert subscribers when alert returns back to normal. |
seconds_to_retrigger | integer | Number of seconds an alert must wait after being triggered to rearm itself. After rearming, it can be triggered again. If 0 or not specified, the alert will not be triggered again. |
state | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />>>> Color.RED<br /><Color.RED: 1><br /><br />- value lookup:<br /><br />>>> Color(1)<br /><Color.RED: 1><br /><br />- name lookup:<br /><br />>>> Color['RED']<br /><Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (OK, TRIGGERED, UNKNOWN) |
trigger_time | string | Timestamp when the alert was last triggered, if the alert has been triggered before. |
update_time | string | The timestamp indicating when the alert was updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id, deployment_name | Gets an alert. | |
list | select | deployment_name | page_size, page_token | Gets a list of alerts accessible to the user, ordered by creation time. Warning: Calling this API |
create | insert | deployment_name | Creates an alert. | |
update | update | id, deployment_name, update_mask | Updates an alert. | |
delete | delete | id, deployment_name | Moves an alert to the trash. Trashed alerts immediately disappear from searches and list views, and |
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.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
id | string | str |
page_size | integer | :param page_token: str (optional) |
page_token | string |
SELECT examples
- get
- list
Gets an alert.
SELECT
id,
query_id,
display_name,
owner_user_name,
condition,
create_time,
custom_body,
custom_subject,
lifecycle_state,
notify_on_ok,
parent_path,
seconds_to_retrigger,
state,
trigger_time,
update_time
FROM databricks_workspace.sql.alerts
WHERE id = '{{ id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
Gets a list of alerts accessible to the user, ordered by creation time. Warning: Calling this API
SELECT
id,
query_id,
display_name,
owner_user_name,
condition,
create_time,
custom_body,
custom_subject,
lifecycle_state,
notify_on_ok,
seconds_to_retrigger,
state,
trigger_time,
update_time
FROM databricks_workspace.sql.alerts
WHERE deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;
INSERT examples
- create
- Manifest
Creates an alert.
INSERT INTO databricks_workspace.sql.alerts (
alert,
auto_resolve_display_name,
deployment_name
)
SELECT
'{{ alert }}',
{{ auto_resolve_display_name }},
'{{ deployment_name }}'
RETURNING
id,
query_id,
display_name,
owner_user_name,
condition,
create_time,
custom_body,
custom_subject,
lifecycle_state,
notify_on_ok,
parent_path,
seconds_to_retrigger,
state,
trigger_time,
update_time
;
# Description fields are for documentation purposes
- name: alerts
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the alerts resource.
- name: alert
description: |
:param auto_resolve_display_name: bool (optional) If true, automatically resolve alert display name conflicts. Otherwise, fail the request if the alert's display name conflicts with an existing alert's display name.
value:
condition:
empty_result_state: "{{ empty_result_state }}"
op: "{{ op }}"
operand:
column:
name: "{{ name }}"
threshold:
value:
bool_value: {{ bool_value }}
double_value: {{ double_value }}
string_value: "{{ string_value }}"
custom_body: "{{ custom_body }}"
custom_subject: "{{ custom_subject }}"
display_name: "{{ display_name }}"
notify_on_ok: {{ notify_on_ok }}
parent_path: "{{ parent_path }}"
query_id: "{{ query_id }}"
seconds_to_retrigger: {{ seconds_to_retrigger }}
- name: auto_resolve_display_name
value: {{ auto_resolve_display_name }}
UPDATE examples
- update
Updates an alert.
UPDATE databricks_workspace.sql.alerts
SET
update_mask = '{{ update_mask }}',
alert = '{{ alert }}',
auto_resolve_display_name = {{ auto_resolve_display_name }}
WHERE
id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND update_mask = '{{ update_mask }}' --required
RETURNING
id,
query_id,
display_name,
owner_user_name,
condition,
create_time,
custom_body,
custom_subject,
lifecycle_state,
notify_on_ok,
parent_path,
seconds_to_retrigger,
state,
trigger_time,
update_time;
DELETE examples
- delete
Moves an alert to the trash. Trashed alerts immediately disappear from searches and list views, and
DELETE FROM databricks_workspace.sql.alerts
WHERE id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;