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

CREATE_QUERY_MONITOR

Stored procedure CREATE_QUERY_MONITOR is a Snowflake SQL stored procedure that is used to construct a query monitor object. This procedure is defined in the 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>,
                     <condition>,
                     <notify_writer>,
                     <notify_writer_method>,
                     <notify_others>,
                     <notify_other_method>,
                     <cancel> )

Arguments

<name>
a string that represents query monitor name.
<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 created.
<error>
error message string in the case of failure to create a query monitor.

Example:

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

kai#COMPUTE_WH@SUNDECK.(no schema)>call ADMIN.CREATE_QUERY_MONITOR(
                                        'cancel_all_insert_queries',
                                        'query_type ilike \'insert\'',
                                        True,
                                        'EMAIL',
                                        'nori@sundeck.io,ube@sundeck.io,ube@sundeck.io',
                                        'EMAIL',
                                        True
                                       );
+------------------------------------------------------------------------+      
| CREATE_QUERY_MONITOR                                                   |
|------------------------------------------------------------------------|
| Failed to create probe: A query monitor with this name already exists. |
+------------------------------------------------------------------------+
1 Row(s) produced.