snowflake.core.compute_pool.ComputePoolCollection¶
- class snowflake.core.compute_pool.ComputePoolCollection(root: Root)¶
- Bases: - ComputePoolCollectionBase- Represents the collection operations on the Snowflake Compute Pool resource. - With this collection, you can create, iterate through, and search for compute pools that you have access to in the current context. - Examples - Creating a compute pool instance: - >>> compute_pool = ComputePool( ... name="my_compute_pool", instance_family="CPU_X64_XS", min_nodes=1, max_nodes=2 ... ) >>> compute_pool_reference = root.compute_pools.create(compute_pool) - Attributes - root¶
- The Root object this collection belongs to. 
 - Methods - create(compute_pool: ComputePoolModel, *, mode: CreateMode = CreateMode.error_if_exists, initially_suspended: bool = False) ComputePoolResource¶
- Create a compute pool in Snowflake. - Parameters:
- compute_pool (ComputePool) – The - ComputePoolobject, together with the- ComputePool’s properties: name, min_nodes, max_nodes, instance_family; auto_resume, initially_suspended, auto_suspend_secs, comment are optional
- mode (CreateMode, optional) – - One of the below enum values. - CreateMode.error_if_exists: Throw an- snowflake.core.exceptions.ConflictErrorif the compute pool already exists in Snowflake. Equivalent to SQL- create compute pool <name> ....- CreateMode.if_not_exists: Do nothing if the compute pool already exists in Snowflake. Equivalent to SQL- create compute pool <name> if not exists....- Default value is - CreateMode.error_if_exists.
- initially_suspended (bool, optional) – Determines if the compute pool should be suspended when initially created. Default value is False. 
 
 - Examples - Creating a compute pool, replacing an existing compute pool with the same name: - >>> compute_pool = ComputePool( ... name="my_compute_pool", instance_family="CPU_X64_XS", min_nodes=1, max_nodes=2 ... ) >>> compute_pool_reference = compute_pools.create(compute_pool, mode=CreateMode.or_replace) - Creating a compute pool that is initially suspended: - >>> compute_pool = ComputePool( ... name="my_compute_pool", instance_family="CPU_X64_XS", min_nodes=1, max_nodes=5 ... ) >>> compute_pool_reference = compute_pools.create(compute_pool, initially_suspended=True) 
 - create_async(compute_pool: ComputePoolModel, *, mode: CreateMode = CreateMode.error_if_exists, initially_suspended: bool = False) PollingOperation[ComputePoolResource]¶
- An asynchronous version of - create().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - items() ItemsView[str, T]¶
 - iter(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None) Iterator[ComputePoolModel]¶
- Iterate through - Compute Poolobjects in Snowflake, filtering on any optional ‘like’ pattern.- Parameters:
- like (str, optional) – A case-insensitive string functioning as a filter, with support for SQL wildcard characters (% and _). 
- starts_with (str, optional) – String used to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching. 
- limit (int, optional) – Limit of the maximum number of rows returned by iter(). The default is - None, which behaves equivalently to show_limit=10000. This value must be between- 1and- 10000.
 
 - Examples - Showing all compute pools that you have access to see: - >>> compute_pools = root.compute_pools.iter() - Showing information of the exact compute pool you want to see: - >>> compute_pools = root.compute_pools.iter(like="your-compute-pool-name") - Showing compute pools starting with ‘your-compute-pool-name-‘: - >>> compute_pools = root.compute_pools.iter(like="your-compute-pool-name-%") - Using a for loop to retrieve information from iterator: - >>> for compute_pool in compute_pools: >>> print(compute_pool.name) 
 - iter_async(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None) PollingOperation[Iterator[ComputePoolModel]]¶
- An asynchronous version of - iter().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - keys() KeysView[str]¶
 - update_reference(old_name: str, new_name: str, resource: T) None¶
- Update the collection with a new item. 
 - values() ValuesView[T]¶