snowflake.core.code_bundle_execution.CodeBundleExecutionResource

class snowflake.core.code_bundle_execution.CodeBundleExecutionResource(name: str, collection: CodeBundleExecutionCollection)

Bases: CodeBundleExecutionResourceBase

Represents a reference to a Snowflake code bundle execution.

A code bundle execution reference is identified by its execution id (the query id of the execution). With this reference you can fetch the execution’s status or cancel it.

Attributes

root

The Root object this reference belongs to.

Methods

cancel() SuccessResponse | SuccessAcceptedResponse

Cancel this code bundle execution.

Returns:

The server’s response to the cancel request (a SuccessResponse carrying a status message).

Return type:

Union[SuccessResponse, SuccessAcceptedResponse]

Examples

Cancelling an execution:

>>> root.code_bundle_execution["<execution_id>"].cancel()
cancel_async() PollingOperation[SuccessResponse | SuccessAcceptedResponse]

An asynchronous version of cancel().

Refer to PollingOperation for more information on asynchronous execution and the return type.

execute_code_bundle(execute_code_bundle_request: ExecuteCodeBundleRequest, async_exec: bool | None = None) None

Execute a code bundle.

Parameters:
  • execute_code_bundle_request (ExecuteCodeBundleRequest) – (required)

  • async_exec (bool) – Asynchronous execution enable/disable. Default is disable.

execute_code_bundle_async(execute_code_bundle_request: ExecuteCodeBundleRequest, async_exec: bool | None = None) PollingOperation[None]

An asynchronous version of execute_code_bundle().

Refer to PollingOperation for more information on asynchronous execution and the return type.

fetch_status() CodeBundleExecution

Fetch the status of this code bundle execution.

Returns:

The status of the execution. If the server returns more than one matching record, the first one is returned.

Return type:

CodeBundleExecution

Raises:

NotFoundError – If no execution with this execution id exists.

Examples

Fetching the status of an execution:

>>> root.code_bundle_execution["<execution_id>"].fetch_status()
fetch_status_async() PollingOperation[CodeBundleExecution]

An asynchronous version of fetch_status().

Refer to PollingOperation for more information on asynchronous execution and the return type.