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 ParamsDescription
fetch_compute_poolSELECTname, endpointFetches a named compute pool. You can get the name of the compute pool from the /api/v2/compute-pools GET request.
list_compute_poolsSELECTendpointLists the compute pools under the account.
create_compute_poolINSERTdata__instance_family, data__max_nodes, data__min_nodes, data__name, endpointCreates 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, endpointDeletes 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, endpointCreate 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, endpointResume a compute pool, if suspended. If the specified compute pool is already running, no action is taken.
stop_all_services_in_compute_poolEXECname, endpointStops all services in the compute pool.
stop_all_services_in_compute_pool_deprecatedEXECname, endpointStops all services in the compute pool. Deprecated - use :stop-all-services instead.
suspend_compute_poolEXECname, endpointSuspend a compute pool, if active. If the specified compute pool is already suspended, no action is taken.

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 }}';