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

UPDATE_LABEL

Stored procedure UPDATE_LABEL is a Snowflake stored procedure written in Python that is used to construct a label 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:
CREATE_LABEL, DELETE_LABEL, SHOW PROCEDURES, DESCRIBE PROCEDURE

Syntax

CREATE_LABEL(<old name>,
             <name>,
             <group>,
             <rank-number>,
             <condition>)

Arguments

<old name>
Specifies label to update.
<name>
a string that represents new label name. Label name can not have the same name as a column in SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY.
<group>
not currently used, specify NULL when calling procedure.
<rank-number>
not currently used, specify NULL when calling procedure.
<condition>
text of the label condition. Should not include WHERE clause.

Returns

NULL
if label was successfully updated.
<error>
error message string in the case of failure to create label.

Example:

coral#COMPUTE_WH@SUNDECK.(no schema)>call ADMIN.UPDATE_LABEL(
                                      'compilation_time_longer_than_30_seconds',
                                      'new_name',
                                      NULL,
                                      NULL,
                                      'COMPILATION_TIME > 30000'
                                      );
+--------------+                                                                
| UPDATE_LABEL |
|--------------|
| NULL         |
+--------------+
1 Row(s) produced. 

coral#COMPUTE_WH@SUNDECK.(no schema)>select name, condition from catalog.labels where name = 'new_name';
+----------+--------------------------+                                         
| NAME     | CONDITION                |
|----------+--------------------------|
| new_name | COMPILATION_TIME > 30000 |
+----------+--------------------------+
1 Row(s) produced. 

coral#COMPUTE_WH@SUNDECK.(no schema)>call ADMIN.UPDATE_LABEL(
                                      'new_name',
                                      'new_name',
                                      NULL,
                                      NULL,
                                      'QUERY_TEXT ilike \'coral\''
                                      );
+--------------+                                                                
| UPDATE_LABEL |
|--------------|
| NULL         |
+--------------+
1 Row(s) produced. 

coral#COMPUTE_WH@SUNDECK.(no schema)>select name, condition from catalog.labels where name = 'new_name';
+----------+--------------------------+                                         
| NAME     | CONDITION                |
|----------+--------------------------|
| new_name | QUERY_TEXT ilike 'coral' |
+----------+--------------------------+
1 Row(s) produced.