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()