snowflake.core.code_bundle_execution.CodeBundleExecutionCollection¶
- class snowflake.core.code_bundle_execution.CodeBundleExecutionCollection(root: Root)¶
Bases:
CodeBundleExecutionCollectionBaseRepresents the collection operations on the Snowflake code bundle execution resource.
A code bundle execution runs a code bundle directly from a stage location, without first creating a named code bundle. Executions are not scoped to a database or schema, so this resource is exposed at the account level. With this collection you can start an execution, and obtain a reference to an existing execution (by its execution id) to fetch its status or cancel it.
Examples
Executing a code bundle:
Supplying the bundle configuration inline with a typed specification:
Getting a reference to an existing execution:
Attributes
- root¶
The Root object this collection belongs to.
Methods
- execute(execute_code_bundle_request: ExecuteCodeBundleRequest, async_exec: bool | None = True) SuccessResponse | SuccessAcceptedResponse¶
Execute a code bundle directly from a stage location.
- Parameters:
execute_code_bundle_request (ExecuteCodeBundleRequest) – The specification of the code bundle to execute, including the stage location to run from (
from_location) and the entry point (entrypoint). (required) The bundle configuration can be supplied inline through the request’sspecificationfield, a typedCodeBundleSpecificationwrapping aBundleSpec; a plaindictmatching the same shape is still accepted. When omitted, the configuration is read from the stage.async_exec (bool, optional) – Whether the code bundle should be executed asynchronously on the server. Defaults to
True, which submits the execution asynchronously and returns once the server has accepted it. PassFalseto run the code bundle synchronously on the server.
- Returns:
A
SuccessResponsewhen the execution completes synchronously, or aSuccessAcceptedResponsewhenasync_execisTrueand the execution was accepted for asynchronous processing.- Return type:
Examples
Executing a code bundle with the configuration read from the stage:
Executing a code bundle with a typed, inline bundle specification:
- execute_async(execute_code_bundle_request: ExecuteCodeBundleRequest, async_exec: bool | None = True) PollingOperation[SuccessResponse | SuccessAcceptedResponse]¶
An asynchronous version of
execute().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- items() ItemsView[str, T]¶
- iter(*, bundle_name: str | None = None, entrypoint: str | None = None, start_time_range_start: str | None = None, start_time_range_end: str | None = None, bundle_types: str | None = None, compute_types: str | None = None, language_types: str | None = None, status: str | None = None, execution_name: str | None = None, query_id: str | None = None, result_limit: int | None = None) Iterator[CodeBundleExecution]¶
List code bundle executions.
- Parameters:
bundle_name (str) – Filter by code bundle name. To match a case-sensitive or special-character identifier, wrap the value in double quotes (for example “0303_replace_test”). Combine with database and schema to scope to a fully qualified bundle.
entrypoint (str) – Exact match on the executed entrypoint file path.
start_time_range_start (str) – Inclusive lower bound on the execution start time, interpreted as TIMESTAMP_LTZ. Accepts any timestamp literal (for example 2026-07-07 or 2026-07-07T00:00:00).
start_time_range_end (str) – Inclusive upper bound on the execution start time, interpreted as TIMESTAMP_LTZ.
bundle_types (str) – Comma-separated, case-insensitive list of bundle types to include. Allowed values: custom, ml, spark.
compute_types (str) – Comma-separated, case-insensitive list of compute types to include. Allowed values: warehouse, compute_pool, serverless.
language_types (str) – Comma-separated, case-insensitive list of language types to include. Allowed values: python, java, scala.
status (str) – Filter by a single execution status (case-insensitive). Allowed values: pending, running, done (succeeded), failed, cancelled (canceled), deleted.
execution_name (str) – Exact match on the caller-supplied execution name.
query_id (str) – Query id of the execute-code-bundle statement, to scope history to a single execution.
result_limit (int) – Maximum number of rows to return. Clamped to [1, CODE_BUNDLE_HISTORY_MAX_RESULT_LIMIT] (default 100).
- iter_async(*, bundle_name: str | None = None, entrypoint: str | None = None, start_time_range_start: str | None = None, start_time_range_end: str | None = None, bundle_types: str | None = None, compute_types: str | None = None, language_types: str | None = None, status: str | None = None, execution_name: str | None = None, query_id: str | None = None, result_limit: int | None = None) PollingOperation[Iterator[CodeBundleExecution]]¶
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]¶