compute_pools
Creates, updates, deletes, gets or lists a compute_pools
resource.
Overview
Name | compute_pools |
Type | Resource |
Id | snowflake.compute_pool.compute_pools |
Fields
The following fields are returned by SELECT
queries:
- list_compute_pools
- fetch_compute_pool
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. |
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. |
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. |
owner | string | Identifier for the current owner of 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. |
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. |
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. |
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. |
owner | string | Identifier for the current owner of 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. |
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 |
---|---|---|---|---|
list_compute_pools | select | endpoint | like , startsWith , showLimit | Lists the compute pools under the account. |
fetch_compute_pool | 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. | |
create_compute_pool | insert | endpoint | 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_compute_pool | replace | 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. | |
delete_compute_pool | 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_compute_pool | 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_compute_pool | exec | name , endpoint | Suspend a compute pool, if active. If the specified compute pool is already suspended, no action is taken. | |
stop_all_services_in_compute_pool_deprecated | exec | name , endpoint | Stops all services in the compute pool. Deprecated - use :stop-all-services instead. | |
stop_all_services_in_compute_pool | 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 |
---|---|---|
endpoint | string | Organization and Account Name (default: orgid-acctid) |
name | string | Identifier (i.e. name) for the resource. |
createMode | string | Query 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 | Query 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 | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. |
showLimit | integer | Query parameter to limit the maximum number of rows returned by a command. |
startsWith | string | Query 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
- list_compute_pools
- fetch_compute_pool
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 }}' -- required
AND like = '{{ like }}'
AND startsWith = '{{ startsWith }}'
AND showLimit = '{{ showLimit }}';
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,
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 name = '{{ name }}' -- required
AND endpoint = '{{ endpoint }}' -- required;
INSERT
examples
- create_compute_pool
- 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.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,
createMode,
initiallySuspended
)
SELECT
'{{ name }}' --required,
{{ min_nodes }} --required,
{{ max_nodes }} --required,
'{{ instance_family }}' --required,
{{ auto_resume }},
'{{ comment }}',
{{ auto_suspend_secs }},
'{{ endpoint }}',
'{{ createMode }}',
'{{ initiallySuspended }}'
;
# Description fields are for documentation purposes
- name: compute_pools
props:
- name: endpoint
value: string
description: Required parameter for the compute_pools resource.
- name: name
value: string
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: integer
description: >
Minimum number of nodes for the compute pool.
- name: max_nodes
value: integer
description: >
Maximum number of nodes for the compute pool.
- name: instance_family
value: string
description: >
Instance family for the compute pool.
- name: auto_resume
value: boolean
description: >
Whether Snowflake automatically resumes the compute pool when any statement that requires the compute pool is submitted.
- name: comment
value: string
description: >
Comment describing the compute pool.
- name: auto_suspend_secs
value: integer
description: >
Number of seconds until the compute pool automatically suspends.
- name: createMode
value: string
description: Query 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: boolean
description: Specifies whether the compute pool is created initially in the suspended state.
REPLACE
examples
- create_or_alter_compute_pool
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.compute_pool.compute_pools
SET
data__name = '{{ name }}',
data__min_nodes = {{ min_nodes }},
data__max_nodes = {{ max_nodes }},
data__instance_family = '{{ instance_family }}',
data__auto_resume = {{ auto_resume }},
data__comment = '{{ comment }}',
data__auto_suspend_secs = {{ auto_suspend_secs }}
WHERE
name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND data__name = '{{ name }}' --required
AND data__instance_family = '{{ instance_family }}' --required
AND data__min_nodes = '{{ min_nodes }}' --required
AND data__max_nodes = '{{ max_nodes }}' --required;
DELETE
examples
- delete_compute_pool
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.compute_pool.compute_pools
WHERE name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';
Lifecycle Methods
- resume_compute_pool
- suspend_compute_pool
- stop_all_services_in_compute_pool_deprecated
- stop_all_services_in_compute_pool
Resume a compute pool, if suspended. If the specified compute pool is already running, this will cause a 400 Bad Request error.
EXEC snowflake.compute_pool.compute_pools.resume_compute_pool
@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.compute_pool.compute_pools.suspend_compute_pool
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required;
Stops all services in the compute pool. Deprecated - use :stop-all-services instead.
EXEC snowflake.compute_pool.compute_pools.stop_all_services_in_compute_pool_deprecated
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required;
Stops all services in the compute pool.
EXEC snowflake.compute_pool.compute_pools.stop_all_services_in_compute_pool
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required;