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, ...)
# 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.
- 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 toFalse
.
Examples
Dropping a compute pool using its reference:
>>> compute_pool_reference.drop()
- 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)
- resume() None ¶
Resume this compute pool.
Examples
Resuming a compute pool using its reference:
>>> compute_pool_reference.resume()
- 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()
- suspend() None ¶
Suspend this compute pool.
Examples
Suspending a compute pool using its reference:
>>> compute_pool_reference.suspend()