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¶
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, ...)
# Using a
ComputePoolCollectionto 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
PollingOperationfor more information on asynchronous execution and the return type.
- 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()
- drop_async(if_exists: bool | None = None) PollingOperation[None]¶
An asynchronous version of
drop().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- 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)
- fetch_async() PollingOperation[ComputePoolModel]¶
An asynchronous version of
fetch().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- resume() None¶
Resume this compute pool.
Examples
Resuming a compute pool using its reference:
>>> compute_pool_reference.resume()
- resume_async() PollingOperation[None]¶
An asynchronous version of
resume().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- 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()
- stop_all_services_async() PollingOperation[None]¶
An asynchronous version of
stop_all_services().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- suspend() None¶
Suspend this compute pool.
Examples
Suspending a compute pool using its reference:
>>> compute_pool_reference.suspend()
- suspend_async() PollingOperation[None]¶
An asynchronous version of
suspend().Refer to
PollingOperationfor more information on asynchronous execution and the return type.