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

UPDATE_WAREHOUSE_SCHEDULE

Stored procedure UPDATE_WAREHOUSE_SCHEDULE is a Snowflake stored procedure written in Python that is used to update a warehouse schedule period object. This procedure is defined in database OPSCENTER (database where Snowflake NativeApp is installed) schema ADMIN.

ACCOUNTADMIN privilege is required to run this stored procedure.

See also:
CREATE_WAREHOUSE_SCHEDULE, DELETE_WAREHOUSE_SCHEDULE, ENABLE_WAREHOUSE_SCHEDULING, DISABLE_WAREHOUSE_SCHEDULING, RESET_WAREHOUSE_SCHEDULING, CREATE_DEFAULT_WAREHOUSE_SCHEDULES

Syntax

UPDATE_WAREHOUSE_SCHEDULE(<warehouse_name>,
			  <start_at>,
			  <finish_at>,
			  <is_weekday>, 
			  <new_start_at>,
			  <new_finish_at>,
			  <size>,
			  <suspend_minutes>,
			  <autoscale_mode>
			  <autoscale_min>
			  <autoscale_max>
			  <auto_resume>
			  <comment>)

Arguments

First four parameters identify warehouse schedule period to be updated:

<warehouse_name>
a string that represents warehouse name to be updated.
<start_at>
schedule period start time of to be updated.
<finish_at>
schedule period end time to be updated.
<is_weekday>
True or False for warehouse schedule period to be updated.

Next are the new settings we are updating to:

<new_start_at>
schedule period start time of to be updated to.
<finish_at>
schedule period end time to be updated to.

Returns

NULL
if warehouse schedule period was successfully updated.
<error>
error message string in the case of failure to update warehouse schedule period.

Example:

We update start time of the weekday schedule period to start from 18:00 instead of 17:00 and changing warehouse size to Medium.

test#COMPUTE_WH@OPSCENTER.ADMIN>select 
                                  name, 
                                  start_at, 
                                  finish_at, 
                                  size, 
                                  resume, 
                                  weekday, 
                                  enabled 
                                from 
                                  catalog.warehouse_schedules 
                                where 
                                  name = 'BATCH' and weekday = True;
+-------+----------+-----------+---------+--------+---------+---------+         
| NAME  | START_AT | FINISH_AT | SIZE    | RESUME | WEEKDAY | ENABLED |
|-------+----------+-----------+---------+--------+---------+---------|
| BATCH | 00:00:00 | 17:00:00  | X-Small | True   | True    | False   |
| BATCH | 17:00:00 | 23:59:00  | Large   | True   | True    | False   |
+-------+----------+-----------+---------+--------+---------+---------+
2 Row(s) produced. 

vicky#COMPUTE_WH@OPSCENTER.ADMIN>call ADMIN.UPDATE_WAREHOUSE_SCHEDULE('BATCH', '17:00:00', '23:59:00', 
                                                                     TRUE, '18:00:00', '23:59:00', 'Medium', 
                                                                     0, 'Standard', 0, 0, TRUE, NULL);
+---------------------------+                                                   
| UPDATE_WAREHOUSE_SCHEDULE |
|---------------------------|
| NULL                      |
+---------------------------+
1 Row(s) produced. 

vicky#COMPUTE_WH@OPSCENTER.ADMIN>select 
                                  name, 
                                  start_at, 
                                  finish_at, 
                                  size, 
                                  resume, 
                                  weekday, 
                                  enabled 
                                from 
                                  catalog.warehouse_schedules 
                                where 
                                  name = 'BATCH' and weekday = True;
+-------+----------+-----------+---------+--------+---------+---------+         
| NAME  | START_AT | FINISH_AT | SIZE    | RESUME | WEEKDAY | ENABLED |
|-------+----------+-----------+---------+--------+---------+---------|
| BATCH | 00:00:00 | 18:00:00  | X-Small | True   | True    | False   |
| BATCH | 18:00:00 | 23:59:00  | Medium  | True   | True    | False   |
+-------+----------+-----------+---------+--------+---------+---------+
2 Row(s) produced.