Documentation
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

UPDATE_QUERY_MONITOR

Stored procedure UPDATE_QUERY_MONITOR is a Snowflake SQL stored procedure that is used to modify a query monitor object. This procedure is defined in database SUNDECK (database where Snowflake NativeApp is installed) schema ADMIN.

ACCOUNTADMIN privilege is required to run this stored procedure.

See also:
UPDATE_QUERY_MONITOR, DELETE_QUERY_MONITOR, SHOW PROCEDURES, DESCRIBE PROCEDURE

Syntax

CREATE_QUERY_MONITOR(<name of the query monitor to update>
                     <new name of the query monitor>,
                     <condition>,
                     <notify_writer>,
                     <notify_writer_method>,
                     <notify_others>,
                     <notify_other_method>,
                     <cancel> )

Arguments

<name of the query monitor to update>
a string that represents query monitor name we are updating.
<name>
a string that represents a new query monitor name. If name of the query monitor remains unchanged, then both names will be the same.
<condition>
text of the query monitor condition. Should not include WHERE clause.
<notify_writer>
boolean value that specifies whether to notify author of the query. If set to True, author will be notified.
<notify_writer_method>
string that specifies notification method: EMAIL or SLACK.
<notify_other>
comma separated list of recepients of the notification.
<notify_other_method>
string that specifies notification method.
<cancel>
boolean value that indicates whether to cancel the query. If set to True, query will be cancelled.

Returns

NULL
if a query monitor was successfully updated.
<error>
error message string in the case of failure to update a query monitor.

Example:

ube#COMPUTE_WH@SUNDECK.(no schema)>call ADMIN.CREATE_QUERY_MONITOR(
                                        'cancel_all_insert_queries',
                                        'query_type ilike \'insert\'',
                                        True,
                                        'EMAIL',
                                        'kai@sundeck.io,nori@sundeck.io,coral@sundeck.io,ube@sundeck.io',
                                        'EMAIL',
                                        True
                                       );
+----------------------+                                                        
| CREATE_QUERY_MONITOR |
|----------------------|
| NULL                 |
+----------------------+
1 Row(s) produced. 

Let’s update query monitor to send notification only to nori@sundeck.io:

ube#COMPUTE_WH@SUNDECK.ADMIN>call ADMIN.UPDATE_QUERY_MONITOR('cancel_all_insert_queries',
                                                                'cancel_all_insert_queries',
                                                                'query_type ilike \'insert\'',
                                                                True,
                                                                'EMAIL',
                                                                'nori@sundeck.io',
                                                                'EMAIL',
                                                                True
                                                                );
+----------------------+                                                        
| UPDATE_QUERY_MONITOR |
|----------------------|
| NULL                 |
+----------------------+
1 Row(s) produced. 

ube#COMPUTE_WH@SUNDECK.ADMIN>select 
                                        name, 
                                        condition, 
                                        notify_other 
                                from    catalog.query_monitors
                                where   name = 'cancel_all_insert_queries';
+---------------------------+---------------------------+-------------------+   
| NAME                      | CONDITION                 | NOTIFY_OTHER      |
|---------------------------+---------------------------+-------------------|
| cancel_all_insert_queries | query_type ilike 'insert' | nori@sundeck.io |
+---------------------------+---------------------------+-------------------+
1 Row(s) produced.