snowflake.core.compute_pool.ComputePoolResourceΒΆ

class snowflake.core.compute_pool.ComputePoolResource(name: str, collection: ComputePoolCollection)ΒΆ

Bases: ObjectReferenceMixin[ComputePoolCollection]

Represents a reference to a Snowflake compute pool.

With this compute pool reference, you can create and fetch information about compute pools, as well as perform certain actions on them.

Attributes

rootΒΆ

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)

delete() β†’ NoneΒΆ

Delete this compute pool.

Examples

Deleting a compute pool using its reference:

>>> compute_pool_reference.delete()
The `delete` method is deprecated; use `drop` instead.
Copy
drop(if_exists: bool | None = None) β†’ NoneΒΆ

Drop this compute pool.

Parameters:

if_exists (bool, optional) – Check the existence of this compute pool before dropping it. Default is None, which is equivalent to False.

Examples

Dropping a compute pool using its reference:

>>> compute_pool_reference.drop()
Copy
fetch() β†’ ComputePoolModelΒΆ

Fetch the details of a compute pool.

Examples

Fetching a reference to a compute pool to print its name:

>>> my_compute_pool = compute_pool_reference.fetch()
>>> print(my_compute_pool.name)
Copy
resume() β†’ NoneΒΆ

Resume this compute pool.

Examples

Resuming a compute pool using its reference:

>>> compute_pool_reference.resume()
Copy
stop_all_services() β†’ NoneΒΆ

Stop all services that run on this compute pool.

Examples

Stopping all services that run on this compute pool using its reference:

>>> compute_pool_reference.stop_all_services()
Copy
suspend() β†’ NoneΒΆ

Suspend this compute pool.

Examples

Suspending a compute pool using its reference:

>>> compute_pool_reference.suspend()
Copy