snowflake.core.compute_pool.ComputePoolResource¶
- class snowflake.core.compute_pool.ComputePoolResource(name: str, collection_class: ComputePoolCollectionBase)¶
Bases:
ComputePoolResourceBaseRepresents 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, ...)
# 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.
- 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
PollingOperationfor 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
PollingOperationfor more information on asynchronous execution and the return type.
- get_tags(with_lineage: bool | None = None) dict[TagResource, TagValue]¶
Get the tag assignments for a compute pool.
Returns all tags assigned to a compute pool. This operation requires an active warehouse.
- Parameters:
with_lineage (bool) – Parameter that specifies whether tag assignments inherited by the object from its ancestors in securable object hierarchy should be returned as well: - true: All tags assigned to this object should be returned, inheritance included. - false: Only tags explicitly assigned to this object should be returned.
- get_tags_async(with_lineage: bool | None = None) PollingOperation[dict[TagResource, TagValue]]¶
An asynchronous version of
get_tags().Refer to
PollingOperationfor 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
PollingOperationfor 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
PollingOperationfor more information on asynchronous execution and the return type.
- set_tags(tags: dict[TagResource, TagValue], if_exists: bool | None = None) None¶
Set tags on a compute pool.
- Parameters:
tags (dict[TagResource, TagValue]) – (required)
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.
- set_tags_async(tags: dict[TagResource, TagValue], if_exists: bool | None = None) PollingOperation[None]¶
An asynchronous version of
set_tags().Refer to
PollingOperationfor 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
PollingOperationfor 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
PollingOperationfor more information on asynchronous execution and the return type.
- unset_tags(tag_resources: set[TagResource], if_exists: bool | None = None) None¶
Unset tags from a compute pool.
- Parameters:
tag_resources (set[TagResource]) – (required)
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.
- unset_tags_async(tag_resources: set[TagResource], if_exists: bool | None = None) PollingOperation[None]¶
An asynchronous version of
unset_tags().Refer to
PollingOperationfor more information on asynchronous execution and the return type.