Skip to main content

warehouses

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

Overview

Namewarehouses
TypeResource
Idsnowflake.warehouse.warehouses

Fields

The following fields are returned by SELECT queries:

A Snowflake virtual warehouse

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. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME)
auto_resumestringSpecifies whether to automatically resume a warehouse when a SQL statement is submitted to it
auto_suspendinteger (int32)time in seconds before auto suspend
availablestring (Percentage)Percentage of the warehouse compute resources that are provisioned and available.
budgetstringComment representing budget for warehouse.
commentstring (comment)Specifies a comment for the warehouse
created_onstring (date-time)Date 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 (warehouse)
max_cluster_countinteger (int32)Specifies the maximum number of clusters for a multi-cluster warehouse
max_concurrency_levelinteger (int32)Object parameter that specifies the concurrency level for SQL statements executed by a warehouse cluster
min_cluster_countinteger (int32)Specifies the minimum number of clusters for a multi-cluster warehouse
otherstring (Percentage)Percentage of the warehouse compute resources that are in a state other than available, provisioning, or quiescing.
ownerstring (role name)Role that owns the warehouse.
owner_role_typestringThe type of role that owns the object.
provisioningstring (Percentage)Percentage of the warehouse compute resources that are in the process of provisioning.
query_acceleration_max_scale_factorinteger (int32)Specifies the maximum scale factor for leasing compute resources for query acceleration. The scale factor is used as a multiplier based on warehouse size
queuedinteger (int32)Number of SQL statements that are queued for the warehouse.
quiescingstring (Percentage)Percentage 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. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME)
resumed_onstring (date-time)Date and time when the warehouse was last started or restarted.
runninginteger (int32)Number 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_clustersinteger (int32)Number of clusters currently started.
statestringThe state of warehouse, possible states: STARTED, STARTING, DYNAMIC, SUSPENDED, RESIZING, RESUMING, SUSPENDING
statement_queued_timeout_in_secondsinteger (int32)Object 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_secondsinteger (int32)Object 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_onstring (date-time)Date 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_limitinteger (int64)Credit 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

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_warehousesselectendpointlikeShow a list of warehouse filtered by pattern. Equivalent to SHOW WAREHOUSE in SQL.
fetch_warehouseselectname, endpointDescribes the warehouse, show information of the chosen warehouse. Equivalent to DESCRIBE WAREHOUSE in SQL.
create_warehouseinsertendpointcreateModeCreate a virtual warehouse. Equivalent to CREATE WAREHOUSE in SQL.
create_or_alter_warehousereplacename, endpointCreate a (or alter an existing) warehouse. Even if the operation is just an alter, the full property set must be provided.
delete_warehousedeletename, endpointifExistsRemoves the specified virtual warehouse from the system. Equivalent to DROP WAREHOUSE in SQL.
resume_warehouseexecname, endpointifExistsBring current warehouse to a usable ‘Running’ state by provisioning compute resources if current warehouse is suspended.
suspend_warehouseexecname, endpointifExistsRemove all compute nodes from a warehouse and put the warehouse into a ‘Suspended’ state if current warehouse is not suspended.
rename_warehouseexecname, endpointifExistsSpecifies a new identifier for the warehouse; must be unique for current account.
abort_all_queries_on_warehouseexecname, endpointifExistsAborts all the queries currently running or queued on the warehouse.
use_warehouseexecname, endpoint[Deprecated] Specifies the active/current warehouse for the session.
enable_warehouseexecname, endpointifExistsEnable an adaptive warehouse and put the warehouse into a ‘enabled’ state, if the warehouse is not enabled.
disable_warehouseexecname, endpointifExistsDisable an adaptive warehouse and put the warehouse into a ‘disabled’ state, if the warehouse is not disabled.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
endpointstringOrganization and Account Name (default: orgid-acctid)
namestringIdentifier (i.e. name) for the resource.
createModestringQuery parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists: Throws an error if you try to create a resource that already exists. - orReplace: Automatically replaces the existing resource with the current one. - ifNotExists: Creates a new resource when an alter is requested for a non-existent resource.
ifExistsbooleanQuery parameter that specifies how to handle the request for a resource that does not exist: - true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false: The endpoint throws an error if the resource doesn't exist.
likestringQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.

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 }}' -- required
AND like = '{{ like }}';

INSERT examples

Create a virtual warehouse. Equivalent to CREATE WAREHOUSE in SQL.

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,
createMode
)
SELECT
'{{ name }}' --required,
'{{ 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 }}',
'{{ createMode }}'
;

REPLACE examples

Create a (or alter an existing) warehouse. Even if the operation is just an alter, the full property set must be provided.

REPLACE snowflake.warehouse.warehouses
SET
data__name = '{{ name }}',
data__warehouse_type = '{{ warehouse_type }}',
data__warehouse_size = '{{ warehouse_size }}',
data__wait_for_completion = '{{ wait_for_completion }}',
data__max_cluster_count = {{ max_cluster_count }},
data__min_cluster_count = {{ min_cluster_count }},
data__scaling_policy = '{{ scaling_policy }}',
data__auto_suspend = {{ auto_suspend }},
data__auto_resume = '{{ auto_resume }}',
data__initially_suspended = '{{ initially_suspended }}',
data__resource_monitor = '{{ resource_monitor }}',
data__comment = '{{ comment }}',
data__enable_query_acceleration = '{{ enable_query_acceleration }}',
data__query_acceleration_max_scale_factor = {{ query_acceleration_max_scale_factor }},
data__max_concurrency_level = {{ max_concurrency_level }},
data__statement_queued_timeout_in_seconds = {{ statement_queued_timeout_in_seconds }},
data__statement_timeout_in_seconds = {{ statement_timeout_in_seconds }},
data__type = '{{ type }}',
data__size = '{{ size }}',
data__warehouse_credit_limit = {{ warehouse_credit_limit }},
data__target_statement_size = '{{ target_statement_size }}'
WHERE
name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND data__name = '{{ name }}' --required;

DELETE examples

Removes the specified virtual warehouse from the system. Equivalent to DROP WAREHOUSE in SQL.

DELETE FROM snowflake.warehouse.warehouses
WHERE name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';

Lifecycle Methods

Bring current warehouse to a usable ‘Running’ state by provisioning compute resources if current warehouse is suspended.

EXEC snowflake.warehouse.warehouses.resume_warehouse 
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required,
@ifExists={{ ifExists }};