snowflake.core.compute_pool.ComputePoolResource

class snowflake.core.compute_pool.ComputePoolResource(name: str, collection_class: ComputePoolCollectionBase)

Bases: ComputePoolResourceBase

Represents a reference to a Snowflake compute pool.

With this compute pool reference, you can fetch information about a compute pool, as well as perform certain actions on it.

Attributes

root

The Root object this reference belongs to.

Methods

create_or_alter(compute_pool: ComputePoolModel) None

Create a compute pool in Snowflake or alter one if it already exists.

Parameters:

compute_pool (ComputePool) – An instance of ComputePool.

Examples

Creating or updating a compute pool in Snowflake:

>>> cp_parameters = ComputePool(
...     name="your-cp-name",
...     instance_family="CPU_X64_XS",
...     min_nodes=1,
...     max_nodes=1,
...)
Copy

# Using a ComputePoolCollection to create or update a compute pool in Snowflake: >>> root.compute_pools[“your-cp-name”].create_or_alter(cp_parameters)

create_or_alter_async(compute_pool: ComputePoolModel) PollingOperation[None]

An asynchronous version of create_or_alter().

Refer to PollingOperation for more information on asynchronous execution and the return type.

delete() None

The delete() method is deprecated; use drop() instead.

drop(if_exists: bool | None = None) None

Deletes a compute pool.

Parameters:

if_exists (bool) – 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.

drop_async(if_exists: bool | None = None) PollingOperation[None]

An asynchronous version of drop().

Refer to PollingOperation for more information on asynchronous execution and the return type.

fetch() ComputePoolModel

Fetch a compute pool.

fetch_async() PollingOperation[ComputePoolModel]

An asynchronous version of fetch().

Refer to PollingOperation for more information on asynchronous execution and the return type.

list_instance_families() Iterable[ComputePoolInstanceFamily]

Lists available compute pool instance families.

list_instance_families_async() PollingOperation[Iterable[ComputePoolInstanceFamily]]

An asynchronous version of list_instance_families().

Refer to PollingOperation for more information on asynchronous execution and the return type.

resume() None

Resumes a suspended compute pool.

resume_async() PollingOperation[None]

An asynchronous version of resume().

Refer to PollingOperation for more information on asynchronous execution and the return type.

stop_all_services() None

Stops all services on the compute pool.

stop_all_services_async() PollingOperation[None]

An asynchronous version of stop_all_services().

Refer to PollingOperation for more information on asynchronous execution and the return type.

suspend() None

Suspends an active compute pool.

suspend_async() PollingOperation[None]

An asynchronous version of suspend().

Refer to PollingOperation for more information on asynchronous execution and the return type.