Skip to main content

compute_pools

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

Overview

Namecompute_pools
TypeResource
Idsnowflake.compute_pool.compute_pools

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.
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_secsintegerNumber 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_onstringTime the compute pool was created.
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.
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.
ownerstringIdentifier for the current owner of the compute pool.
resumed_onstringTime the compute pool was last resumed.
statestringCurrent state of the compute pool. Possible values include UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, and RESIZING.
status_messagestringCurrent status of the compute pool if any.
target_nodesintegerNumber of target nodes on the compute pool.
updated_onstringTime the compute pool was last updated.

Methods

NameAccessible byRequired ParamsOptional ParamsDescription
fetch_compute_poolSELECTname, endpoint-Fetches a named compute pool. You can get the name of the compute pool from the /api/v2/compute-pools GET request.
list_compute_poolsSELECTendpointlike, startsWith, showLimitLists the compute pools under the account.
create_compute_poolINSERTdata__instance_family, data__max_nodes, data__min_nodes, data__name, endpointcreateMode, 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.
delete_compute_poolDELETEname, 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.
create_or_alter_compute_poolREPLACEname, data__instance_family, data__max_nodes, data__min_nodes, data__name, endpoint-Create a (or alter an existing) compute pool. Even if the operation is just an alter, the full property set must be provided.
resume_compute_poolEXECname, endpoint-Resume a compute pool, if suspended. If the specified compute pool is already running, no action is taken.
stop_all_services_in_compute_poolEXECname, endpoint-Stops all services in the compute pool.
stop_all_services_in_compute_pool_deprecatedEXECname, endpoint-Stops all services in the compute pool. Deprecated - use :stop-all-services instead.
suspend_compute_poolEXECname, endpoint-Suspend a compute pool, if active. If the specified compute pool is already suspended, no action is taken.

Optional Parameter Details
NameDescriptionTypeDefault
createModeQuery 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.stringerrorIfExists
ifExistsQuery 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.booleanfalse
initiallySuspendedSpecifies whether the compute pool is created initially in the suspended state.boolean-
likeQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.string-
showLimitQuery parameter to limit the maximum number of rows returned by a command.integer-
startsWithQuery parameter 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.string-

SELECT examples

Lists the compute pools under the account.

SELECT
name,
active_nodes,
application,
auto_resume,
auto_suspend_secs,
budget,
comment,
created_on,
error_code,
idle_nodes,
instance_family,
is_exclusive,
max_nodes,
min_nodes,
num_jobs,
num_services,
owner,
resumed_on,
state,
status_message,
target_nodes,
updated_on
FROM snowflake.compute_pool.compute_pools
WHERE endpoint = '{{ endpoint }}';

INSERT example

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

/*+ create */
INSERT INTO snowflake.compute_pool.compute_pools (
data__name,
data__min_nodes,
data__max_nodes,
data__instance_family,
data__auto_resume,
data__comment,
data__auto_suspend_secs,
endpoint
)
SELECT
'{{ name }}',
'{{ min_nodes }}',
'{{ max_nodes }}',
'{{ instance_family }}',
'{{ auto_resume }}',
'{{ comment }}',
'{{ auto_suspend_secs }}',
'{{ endpoint }}'
;

REPLACE example

Replaces all fields in the specified compute_pools resource.

/*+ update */
REPLACE snowflake.compute_pool.compute_pools
SET
name = '{{ name }}',
min_nodes = '{{ min_nodes }}',
max_nodes = '{{ max_nodes }}',
instance_family = '{{ instance_family }}',
auto_resume = true|false,
comment = '{{ comment }}',
auto_suspend_secs = '{{ auto_suspend_secs }}'
WHERE
name = '{{ name }}'
AND data__instance_family = '{{ data__instance_family }}'
AND data__max_nodes = '{{ data__max_nodes }}'
AND data__min_nodes = '{{ data__min_nodes }}'
AND data__name = '{{ data__name }}'
AND endpoint = '{{ endpoint }}';

DELETE example

Deletes the specified compute_pools resource.

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