alerts_legacy
Creates, updates, deletes, gets or lists an alerts_legacy resource.
Overview
| Name | alerts_legacy |
| Type | Resource |
| Id | databricks_workspace.sql.alerts_legacy |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Alert ID. |
name | string | Name of the alert. |
created_at | string | |
last_triggered_at | string | Timestamp when the alert was last triggered. |
options | object | Alert configuration options. |
parent | string | The identifier of the workspace folder containing the object. |
query | object | |
rearm | integer | Number of seconds after being triggered before the alert rearms itself and can be triggered again. If `null`, alert will never be triggered again. |
state | string | State 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_at | string | Timestamp when the alert was last updated. |
user | object |
| Name | Datatype | Description |
|---|---|---|
id | string | Alert ID. |
name | string | Name of the alert. |
created_at | string | |
last_triggered_at | string | Timestamp when the alert was last triggered. |
options | object | Alert configuration options. |
parent | string | The identifier of the workspace folder containing the object. |
query | object | |
rearm | integer | Number of seconds after being triggered before the alert rearms itself and can be triggered again. If `null`, alert will never be triggered again. |
state | string | State 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_at | string | Timestamp when the alert was last updated. |
user | object |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | alert_id, deployment_name | Gets an alert. | |
list | select | deployment_name | Gets a list of alerts. | |
create | insert | deployment_name, name, options, query_id | Creates an alert. An alert is a Databricks SQL object that periodically runs a query, evaluates a | |
update | replace | alert_id, deployment_name, name, options, query_id | Updates an alert. | |
delete | delete | alert_id, deployment_name | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
alert_id | string | str |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
SELECT examples
- get
- list
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
;
Gets a list of alerts.
SELECT
id,
name,
created_at,
last_triggered_at,
options,
parent,
query,
rearm,
state,
updated_at,
user
FROM databricks_workspace.sql.alerts_legacy
WHERE deployment_name = '{{ deployment_name }}' -- required
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: alerts_legacy
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the alerts_legacy resource.
- name: name
value: "{{ name }}"
description: |
Name of the alert.
- name: options
description: |
Alert configuration options.
value:
column: "{{ column }}"
op: "{{ op }}"
value: "{{ value }}"
custom_body: "{{ custom_body }}"
custom_subject: "{{ custom_subject }}"
empty_result_state: "{{ empty_result_state }}"
muted: {{ muted }}
- name: query_id
value: "{{ query_id }}"
description: |
Query ID.
- name: parent
value: "{{ parent }}"
description: |
The identifier of the workspace folder containing the object.
- name: rearm
value: {{ rearm }}
description: |
Number of seconds after being triggered before the alert rearms itself and can be triggered again. If `null`, alert will never be triggered again.
REPLACE examples
- update
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
- delete
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
;