Skip to main content

warehouses

Creates, updates, deletes, gets or lists a warehouses resource.

Overview

Namewarehouses
TypeResource
Idsnowflake.warehouse.warehouses

Fields

NameDatatypeDescription
namestringA Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
auto_resumestringSpecifies whether to automatically resume a warehouse when a SQL statement is submitted to it
auto_suspendintegertime in seconds before auto suspend
availablestringPercentage of the warehouse compute resources that are provisioned and available.
budgetstringComment representing budget for warehouse.
commentstringSpecifies a comment for the warehouse
created_onstringDate and time when the warehouse was created.
enable_query_accelerationstringSpecifies whether to enable the query acceleration service for queries that rely on this warehouse for compute resources
initially_suspendedstringSpecifies whether the warehouse is created initially in the Suspended state
is_currentbooleanWhether the warehouse is in use for the session. Only one warehouse can be in use at a time for a session. To specify or change the warehouse for a session, use the USE WAREHOUSE command.
is_defaultbooleanWhether the warehouse is the default for the current user.
kindstring
max_cluster_countintegerSpecifies the maximum number of clusters for a multi-cluster warehouse
max_concurrency_levelintegerObject parameter that specifies the concurrency level for SQL statements executed by a warehouse cluster
min_cluster_countintegerSpecifies the minimum number of clusters for a multi-cluster warehouse
otherstringPercentage of the warehouse compute resources that are in a state other than available, provisioning, or quiescing.
ownerstringRole that owns the warehouse.
owner_role_typestringThe type of role that owns the object.
provisioningstringPercentage of the warehouse compute resources that are in the process of provisioning.
query_acceleration_max_scale_factorintegerSpecifies the maximum scale factor for leasing compute resources for query acceleration. The scale factor is used as a multiplier based on warehouse size
queuedintegerNumber of SQL statements that are queued for the warehouse.
quiescingstringPercentage of the warehouse compute resources that are executing SQL statements, but will be shut down once the queries complete.
resource_monitorstringA Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
resumed_onstringDate and time when the warehouse was last started or restarted.
runningintegerNumber of SQL statements that are being executed by the warehouse.
scaling_policystringScaling policy of warehouse, possible scaling policies: STANDARD, ECONOMY
sizestring[Deprecated] names of size: X-Small, Small, Medium, Large, X-Large, 2X-Large, 3X-Large, 4X-Large, 5X-Large, 6X-Large
started_clustersintegerNumber of clusters currently started.
statestringThe state of warehouse, possible states: STARTED, STARTING, DYNAMIC, SUSPENDED, RESIZING, RESUMING, SUSPENDING
statement_queued_timeout_in_secondsintegerObject parameter that specifies the time, in seconds, a SQL statement can be queued on a warehouse before it is canceled by the system
statement_timeout_in_secondsintegerObject parameter that specifies the time, in seconds, after which a running SQL statement is canceled by the system
target_statement_sizestringNames of size: X-Small, Small, Medium, Large, X-Large, 2X-Large, 3X-Large, 4X-Large, 5X-Large, 6X-Large
typestring[Deprecated] Type of warehouse, possible types: STANDARD, SNOWPARK-OPTIMIZED
updated_onstringDate and time when the warehouse was last updated, which includes changing any of the properties of the warehouse or changing the state (STARTED, SUSPENDED, RESIZING) of the warehouse.
wait_for_completionstringWhen resizing a warehouse, you can use this parameter to block the return of the ALTER WAREHOUSE command until the resize has finished provisioning all its compute resources
warehouse_credit_limitintegerCredit limit that are can be executed by the warehouse.
warehouse_sizestringSize of warehouse, possible sizes: XSMALL, SMALL, MEDIUM, LARGE, XLARGE, XXLARGE, XXXLARGE, X4LARGE, X5LARGE, X6LARGE
warehouse_typestringType of warehouse, possible types: STANDARD, SNOWPARK-OPTIMIZED

Methods

NameAccessible byRequired ParamsDescription
fetch_warehouseSELECTname, endpointDescribes the warehouse, show information of the chosen warehouse. Equivalent to DESCRIBE WAREHOUSE in SQL.
list_warehousesSELECTendpointShow a list of warehouse filtered by pattern. Equivalent to SHOW WAREHOUSE in SQL.
create_warehouseINSERTdata__name, endpointCreate a virtual warehouse. Equivalent to CREATE WAREHOUSE in SQL.
delete_warehouseDELETEname, endpointRemoves the specified virtual warehouse from the system. Equivalent to DROP WAREHOUSE in SQL.
create_or_alter_warehouseREPLACEname, data__name, endpointCreate a (or alter an existing) warehouse. Even if the operation is just an alter, the full property set must be provided.
abort_all_queries_on_warehouseEXECname, endpointAborts all the queries currently running or queued on the warehouse.
disable_warehouseEXECname, endpointDisable an adaptive warehouse and put the warehouse into a ‘disabled’ state, if the warehouse is not disabled.
enable_warehouseEXECname, endpointEnable an adaptive warehouse and put the warehouse into a ‘enabled’ state, if the warehouse is not enabled.
rename_warehouseEXECname, data__name, endpointSpecifies a new identifier for the warehouse; must be unique for current account.
resume_warehouseEXECname, endpointBring current warehouse to a usable ‘Running’ state by provisioning compute resources if current warehouse is suspended.
suspend_warehouseEXECname, endpointRemove all compute nodes from a warehouse and put the warehouse into a ‘Suspended’ state if current warehouse is not suspended.
use_warehouseEXECname, endpoint[Deprecated] Specifies the active/current warehouse for the session.

SELECT examples

Show a list of warehouse filtered by pattern. Equivalent to SHOW WAREHOUSE in SQL.

SELECT
name,
auto_resume,
auto_suspend,
available,
budget,
comment,
created_on,
enable_query_acceleration,
initially_suspended,
is_current,
is_default,
kind,
max_cluster_count,
max_concurrency_level,
min_cluster_count,
other,
owner,
owner_role_type,
provisioning,
query_acceleration_max_scale_factor,
queued,
quiescing,
resource_monitor,
resumed_on,
running,
scaling_policy,
size,
started_clusters,
state,
statement_queued_timeout_in_seconds,
statement_timeout_in_seconds,
target_statement_size,
type,
updated_on,
wait_for_completion,
warehouse_credit_limit,
warehouse_size,
warehouse_type
FROM snowflake.warehouse.warehouses
WHERE endpoint = '{{ endpoint }}';

INSERT example

Use the following StackQL query and manifest file to create a new warehouses resource.

/*+ create */
INSERT INTO snowflake.warehouse.warehouses (
data__name,
data__warehouse_type,
data__warehouse_size,
data__wait_for_completion,
data__max_cluster_count,
data__min_cluster_count,
data__scaling_policy,
data__auto_suspend,
data__auto_resume,
data__initially_suspended,
data__resource_monitor,
data__comment,
data__enable_query_acceleration,
data__query_acceleration_max_scale_factor,
data__max_concurrency_level,
data__statement_queued_timeout_in_seconds,
data__statement_timeout_in_seconds,
data__type,
data__size,
data__warehouse_credit_limit,
data__target_statement_size,
endpoint
)
SELECT
'{{ name }}',
'{{ warehouse_type }}',
'{{ warehouse_size }}',
'{{ wait_for_completion }}',
'{{ max_cluster_count }}',
'{{ min_cluster_count }}',
'{{ scaling_policy }}',
'{{ auto_suspend }}',
'{{ auto_resume }}',
'{{ initially_suspended }}',
'{{ resource_monitor }}',
'{{ comment }}',
'{{ enable_query_acceleration }}',
'{{ query_acceleration_max_scale_factor }}',
'{{ max_concurrency_level }}',
'{{ statement_queued_timeout_in_seconds }}',
'{{ statement_timeout_in_seconds }}',
'{{ type }}',
'{{ size }}',
'{{ warehouse_credit_limit }}',
'{{ target_statement_size }}',
'{{ endpoint }}'
;

REPLACE example

Replaces all fields in the specified warehouses resource.

/*+ update */
REPLACE snowflake.warehouse.warehouses
SET
name = '{{ name }}',
warehouse_type = '{{ warehouse_type }}',
warehouse_size = '{{ warehouse_size }}',
wait_for_completion = '{{ wait_for_completion }}',
max_cluster_count = '{{ max_cluster_count }}',
min_cluster_count = '{{ min_cluster_count }}',
scaling_policy = '{{ scaling_policy }}',
auto_suspend = '{{ auto_suspend }}',
auto_resume = '{{ auto_resume }}',
initially_suspended = '{{ initially_suspended }}',
resource_monitor = '{{ resource_monitor }}',
comment = '{{ comment }}',
enable_query_acceleration = '{{ enable_query_acceleration }}',
query_acceleration_max_scale_factor = '{{ query_acceleration_max_scale_factor }}',
max_concurrency_level = '{{ max_concurrency_level }}',
statement_queued_timeout_in_seconds = '{{ statement_queued_timeout_in_seconds }}',
statement_timeout_in_seconds = '{{ statement_timeout_in_seconds }}',
type = '{{ type }}',
size = '{{ size }}',
warehouse_credit_limit = '{{ warehouse_credit_limit }}',
target_statement_size = '{{ target_statement_size }}'
WHERE
name = '{{ name }}'
AND data__name = '{{ data__name }}'
AND endpoint = '{{ endpoint }}';

DELETE example

Deletes the specified warehouses resource.

/*+ delete */
DELETE FROM snowflake.warehouse.warehouses
WHERE name = '{{ name }}'
AND endpoint = '{{ endpoint }}';