Skip to main content

compute_pools

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

Overview

Namecompute_pools
TypeResource
Idsnowflake.warehouses.compute_pools

Fields

The following fields are returned by SELECT queries:

Successful request.

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)
active_nodesintegerNumber of currently active nodes on the compute pool.
applicationstringName of the Snowflake Native App if the compute pool is created exclusively for the app.
auto_resumebooleanWhether Snowflake automatically resumes the compute pool when any statement that requires the compute pool is submitted.
auto_suspend_secsinteger (int64)Number of seconds until the compute pool automatically suspends.
budgetstringThe name of the budget monitoring the credit usage of the compute pool.
commentstringComment describing the compute pool.
created_onstring (date-time)Time the compute pool was created.
desired_nodesintegerNumber of nodes to maintain on the compute pool
desired_nodes_expire_afterstring (date-time)Time after which the desired nodes on the compute pool will expire.
error_codestringCurrent error the compute pool hit if any.
idle_nodesintegerNumber of currently idle nodes on the compute pool.
instance_familystringInstance family for the compute pool. Use the /api/v2/compute-pools/instance-families endpoint to retrieve available values.
is_exclusivebooleanWhether a compute pool is created exclusively for a Snowflake Native App.
max_nodesintegerMaximum number of nodes for the compute pool.
min_nodesintegerMinimum number of nodes for the compute pool.
num_jobsintegerNumber of jobs on the compute pool.
num_servicesintegerNumber of services on the compute pool.
optimize_for_capacitybooleanWhether the compute pool is optimized for capacity.
ownerstringIdentifier for the current owner of the compute pool.
placement_groupstringThe name of the placement group on the compute pool.
resumed_onstring (date-time)Time the compute pool was last resumed.
statestringCurrent state of the compute pool. Possible values include UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, and RESIZING. (UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, RESIZING)
status_messagestringCurrent status of the compute pool if any.
target_nodesintegerNumber of target nodes on the compute pool.
updated_onstring (date-time)Time the compute pool was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, endpointFetches a named compute pool. You can get the name of the compute pool from the /api/v2/compute-pools GET request.
listselectendpointlike, startsWith, showLimitLists the compute pools under the account.
createinsertendpoint, name, instance_family, min_nodes, max_nodescreateMode, initiallySuspendedCreates a compute pool, with standard create modifiers as query parameters. See the Compute Pool component definition for what is required to be provided in the request body.
create_or_alterreplacecompute_pool_name, endpoint, name, instance_family, min_nodes, max_nodesCreate a (or alter an existing) compute pool. Even if the operation is just an alter, the full property set must be provided.
deletedeletename, endpointifExistsDeletes a compute pool with the given name. If you enable the ifExists parameter, the operation succeeds even if the object does not exist. Otherwise, a 404 failure is returned if the object does not exist.
resumeexecname, endpointResume a compute pool, if suspended. If the specified compute pool is already running, this will cause a 400 Bad Request error.
suspendexecname, endpointSuspend a compute pool, if active. If the specified compute pool is already suspended, no action is taken.
stop_all_servicesexecname, endpointStops all services in the compute pool.

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
compute_pool_namestringIdentifier (i.e. name) for the resource.
endpointstringOrganization and account identifier (orgname-accountname) (default: orgname-accountname)
namestringIdentifier (i.e. name) for the resource.
createModestringParameter 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.
ifExistsbooleanParameter 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.
initiallySuspendedbooleanSpecifies whether the compute pool is created initially in the suspended state.
likestringParameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.
showLimitintegerParameter to limit the maximum number of rows returned by a command.
startsWithstringParameter to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching.

SELECT examples

Fetches a named compute pool. You can get the name of the compute pool from the /api/v2/compute-pools GET request.

SELECT
name,
active_nodes,
application,
auto_resume,
auto_suspend_secs,
budget,
comment,
created_on,
desired_nodes,
desired_nodes_expire_after,
error_code,
idle_nodes,
instance_family,
is_exclusive,
max_nodes,
min_nodes,
num_jobs,
num_services,
optimize_for_capacity,
owner,
placement_group,
resumed_on,
state,
status_message,
target_nodes,
updated_on
FROM snowflake.warehouses.compute_pools
WHERE name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;

INSERT examples

Creates a compute pool, with standard create modifiers as query parameters. See the Compute Pool component definition for what is required to be provided in the request body.

INSERT INTO snowflake.warehouses.compute_pools (
name,
min_nodes,
max_nodes,
instance_family,
auto_resume,
comment,
auto_suspend_secs,
endpoint,
createMode,
initiallySuspended
)
SELECT
'{{ name }}' /* required */,
{{ min_nodes }} /* required */,
{{ max_nodes }} /* required */,
'{{ instance_family }}' /* required */,
{{ auto_resume }},
'{{ comment }}',
{{ auto_suspend_secs }},
'{{ endpoint }}',
'{{ createMode }}',
'{{ initiallySuspended }}'
RETURNING
status
;

REPLACE examples

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

REPLACE snowflake.warehouses.compute_pools
SET
name = '{{ name }}',
min_nodes = {{ min_nodes }},
max_nodes = {{ max_nodes }},
instance_family = '{{ instance_family }}',
auto_resume = {{ auto_resume }},
comment = '{{ comment }}',
auto_suspend_secs = {{ auto_suspend_secs }}
WHERE
compute_pool_name = '{{ compute_pool_name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND name = '{{ name }}' --required
AND instance_family = '{{ instance_family }}' --required
AND min_nodes = '{{ min_nodes }}' --required
AND max_nodes = '{{ max_nodes }}' --required
RETURNING
status;

DELETE examples

Deletes a compute pool with the given name. If you enable the ifExists parameter, the operation succeeds even if the object does not exist. Otherwise, a 404 failure is returned if the object does not exist.

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

Lifecycle Methods

Resume a compute pool, if suspended. If the specified compute pool is already running, this will cause a 400 Bad Request error.

EXEC snowflake.warehouses.compute_pools.resume
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
;