compute_pools
Creates, updates, deletes, gets or lists a compute_pools resource.
Overview
| Name | compute_pools |
| Type | Resource |
| Id | snowflake.warehouses.compute_pools |
Fields
The following fields are returned by SELECT queries:
- get
- list
Successful request.
| Name | Datatype | Description |
|---|---|---|
name | string | A 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_nodes | integer | Number of currently active nodes on the compute pool. |
application | string | Name of the Snowflake Native App if the compute pool is created exclusively for the app. |
auto_resume | boolean | Whether Snowflake automatically resumes the compute pool when any statement that requires the compute pool is submitted. |
auto_suspend_secs | integer (int64) | Number of seconds until the compute pool automatically suspends. |
budget | string | The name of the budget monitoring the credit usage of the compute pool. |
comment | string | Comment describing the compute pool. |
created_on | string (date-time) | Time the compute pool was created. |
desired_nodes | integer | Number of nodes to maintain on the compute pool |
desired_nodes_expire_after | string (date-time) | Time after which the desired nodes on the compute pool will expire. |
error_code | string | Current error the compute pool hit if any. |
idle_nodes | integer | Number of currently idle nodes on the compute pool. |
instance_family | string | Instance family for the compute pool. Use the /api/v2/compute-pools/instance-families endpoint to retrieve available values. |
is_exclusive | boolean | Whether a compute pool is created exclusively for a Snowflake Native App. |
max_nodes | integer | Maximum number of nodes for the compute pool. |
min_nodes | integer | Minimum number of nodes for the compute pool. |
num_jobs | integer | Number of jobs on the compute pool. |
num_services | integer | Number of services on the compute pool. |
optimize_for_capacity | boolean | Whether the compute pool is optimized for capacity. |
owner | string | Identifier for the current owner of the compute pool. |
placement_group | string | The name of the placement group on the compute pool. |
resumed_on | string (date-time) | Time the compute pool was last resumed. |
state | string | Current state of the compute pool. Possible values include UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, and RESIZING. (UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, RESIZING) |
status_message | string | Current status of the compute pool if any. |
target_nodes | integer | Number of target nodes on the compute pool. |
updated_on | string (date-time) | Time the compute pool was last updated. |
A Snowflake compute pool definition.
| Name | Datatype | Description |
|---|---|---|
name | string | A 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_nodes | integer | Number of currently active nodes on the compute pool. |
application | string | Name of the Snowflake Native App if the compute pool is created exclusively for the app. |
auto_resume | boolean | Whether Snowflake automatically resumes the compute pool when any statement that requires the compute pool is submitted. |
auto_suspend_secs | integer (int64) | Number of seconds until the compute pool automatically suspends. |
budget | string | The name of the budget monitoring the credit usage of the compute pool. |
comment | string | Comment describing the compute pool. |
created_on | string (date-time) | Time the compute pool was created. |
desired_nodes | integer | Number of nodes to maintain on the compute pool |
desired_nodes_expire_after | string (date-time) | Time after which the desired nodes on the compute pool will expire. |
error_code | string | Current error the compute pool hit if any. |
idle_nodes | integer | Number of currently idle nodes on the compute pool. |
instance_family | string | Instance family for the compute pool. Use the /api/v2/compute-pools/instance-families endpoint to retrieve available values. |
is_exclusive | boolean | Whether a compute pool is created exclusively for a Snowflake Native App. |
max_nodes | integer | Maximum number of nodes for the compute pool. |
min_nodes | integer | Minimum number of nodes for the compute pool. |
num_jobs | integer | Number of jobs on the compute pool. |
num_services | integer | Number of services on the compute pool. |
optimize_for_capacity | boolean | Whether the compute pool is optimized for capacity. |
owner | string | Identifier for the current owner of the compute pool. |
placement_group | string | The name of the placement group on the compute pool. |
resumed_on | string (date-time) | Time the compute pool was last resumed. |
state | string | Current state of the compute pool. Possible values include UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, and RESIZING. (UNKNOWN, STARTING, IDLE, ACTIVE, STOPPING, SUSPENDED, RESIZING) |
status_message | string | Current status of the compute pool if any. |
target_nodes | integer | Number of target nodes on the compute pool. |
updated_on | string (date-time) | Time the compute pool was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | name, endpoint | Fetches a named compute pool. You can get the name of the compute pool from the /api/v2/compute-pools GET request. | |
list | select | endpoint | like, startsWith, showLimit | Lists the compute pools under the account. |
create | insert | endpoint, name, instance_family, min_nodes, max_nodes | createMode, initiallySuspended | 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. |
create_or_alter | replace | compute_pool_name, endpoint, name, instance_family, min_nodes, max_nodes | Create a (or alter an existing) compute pool. Even if the operation is just an alter, the full property set must be provided. | |
delete | delete | name, endpoint | ifExists | 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. |
resume | exec | name, endpoint | Resume a compute pool, if suspended. If the specified compute pool is already running, this will cause a 400 Bad Request error. | |
suspend | exec | name, endpoint | Suspend a compute pool, if active. If the specified compute pool is already suspended, no action is taken. | |
stop_all_services | exec | name, endpoint | Stops 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.
| Name | Datatype | Description |
|---|---|---|
compute_pool_name | string | Identifier (i.e. name) for the resource. |
endpoint | string | Organization and account identifier (orgname-accountname) (default: orgname-accountname) |
name | string | Identifier (i.e. name) for the resource. |
createMode | string | 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. |
ifExists | boolean | 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. |
initiallySuspended | boolean | Specifies whether the compute pool is created initially in the suspended state. |
like | string | Parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. |
showLimit | integer | Parameter to limit the maximum number of rows returned by a command. |
startsWith | string | 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. |
SELECT examples
- get
- list
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
;
Lists the compute pools under the account.
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 endpoint = '{{ endpoint }}' -- required
AND "like" = '{{ like }}'
AND startsWith = '{{ startsWith }}'
AND showLimit = '{{ showLimit }}'
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: compute_pools
props:
- name: endpoint
value: "{{ endpoint }}"
description: Required parameter for the compute_pools resource.
- name: name
value: "{{ name }}"
description: |
A 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.
- name: min_nodes
value: {{ min_nodes }}
description: |
Minimum number of nodes for the compute pool.
- name: max_nodes
value: {{ max_nodes }}
description: |
Maximum number of nodes for the compute pool.
- name: instance_family
value: "{{ instance_family }}"
description: |
Instance family for the compute pool. Use the /api/v2/compute-pools/instance-families endpoint to retrieve available values.
- name: auto_resume
value: {{ auto_resume }}
description: |
Whether Snowflake automatically resumes the compute pool when any statement that requires the compute pool is submitted.
- name: comment
value: "{{ comment }}"
description: |
Comment describing the compute pool.
- name: auto_suspend_secs
value: {{ auto_suspend_secs }}
description: |
Number of seconds until the compute pool automatically suspends.
- name: createMode
value: "{{ createMode }}"
description: 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.
description: 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.
- name: initiallySuspended
value: {{ initiallySuspended }}
description: Specifies whether the compute pool is created initially in the suspended state.
description: Specifies whether the compute pool is created initially in the suspended state.
REPLACE examples
- create_or_alter
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
- delete
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
- suspend
- stop_all_services
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
;
Suspend a compute pool, if active. If the specified compute pool is already suspended, no action is taken.
EXEC snowflake.warehouses.compute_pools.suspend
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
;
Stops all services in the compute pool.
EXEC snowflake.warehouses.compute_pools.stop_all_services
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required
;