alerts
Creates, updates, deletes, gets or lists a alerts
resource.
Overview
Name | alerts |
Type | Resource |
Id | snowflake.alert.alerts |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Name of the alert |
action | string | The SQL statement to execute when the alert is triggered |
comment | string | user comment associated to an object in the dictionary |
condition | string | The SQL statement that must be evaluated to determine whether to trigger the alert |
created_on | string | Date and time when the alert was created. |
database_name | string | Database in which the alert is stored |
owner | string | Role that owns the alert |
owner_role_type | string | The type of role that owns the alert |
schedule | object | |
schema_name | string | Schema in which the alert is stored |
state | string | The current state of the alert |
warehouse | string | The warehouse the alert runs in |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
fetch_alert | SELECT | database_name, name, schema_name, endpoint | Fetch an alert |
list_alerts | SELECT | database_name, schema_name, endpoint | List alerts |
create_alert | INSERT | database_name, schema_name, data__action, data__condition, data__name, data__schedule, endpoint | Create an alert |
delete_alert | DELETE | database_name, name, schema_name, endpoint | Delete an alert |
clone_alert | EXEC | database_name, name, schema_name, targetDatabase, targetSchema, data__name, endpoint | Create a new alert by cloning from the specified resource |
execute_alert | EXEC | database_name, name, schema_name, endpoint | Execute an alert |
SELECT
examples
List alerts
SELECT
name,
action,
comment,
condition,
created_on,
database_name,
owner,
owner_role_type,
schedule,
schema_name,
state,
warehouse
FROM snowflake.alert.alerts
WHERE database_name = '{{ database_name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
INSERT
example
Use the following StackQL query and manifest file to create a new alerts
resource.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO snowflake.alert.alerts (
data__name,
data__comment,
data__schedule,
data__warehouse,
data__condition,
data__action,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ comment }}',
'{{ schedule }}',
'{{ warehouse }}',
'{{ condition }}',
'{{ action }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
/*+ create */
INSERT INTO snowflake.alert.alerts (
data__name,
data__schedule,
data__condition,
data__action,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ schedule }}',
'{{ condition }}',
'{{ action }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
- name: alerts
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__action
value: string
- name: data__condition
value: string
- name: data__name
value: string
- name: data__schedule
value: string
- name: endpoint
value: string
- name: name
value: string
- name: comment
value: string
- name: schedule
props:
- name: schedule_type
value: string
- name: warehouse
value: string
- name: condition
value: string
- name: action
value: string
DELETE
example
Deletes the specified alerts
resource.
/*+ delete */
DELETE FROM snowflake.alert.alerts
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';