snowflake.core.code_bundle.CodeBundleResource¶
- class snowflake.core.code_bundle.CodeBundleResource(name: str, collection: CodeBundleCollection)¶
Bases:
CodeBundleResourceBaseRepresents a reference to a Snowflake code bundle.
With this code bundle reference, you can fetch information about a code bundle, as well as perform certain actions on it, such as adding a version, executing it, or dropping it.
Attributes
- database¶
The DatabaseResource this reference belongs to.
- fully_qualified_name¶
Return the fully qualified name of the object this reference points to.
- root¶
The Root object this reference belongs to.
Methods
- add_version(add_version_code_bundle_request: AddVersionCodeBundleRequest) None¶
Add a version to a code bundle.
- Parameters:
add_version_code_bundle_request (AddVersionCodeBundleRequest) – (required)
- add_version_async(add_version_code_bundle_request: AddVersionCodeBundleRequest) PollingOperation[None]¶
An asynchronous version of
add_version().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- drop(if_exists: bool | None = None) None¶
Delete a code bundle.
- 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.
- execute(execute_code_bundle_request: ExecuteCodeBundleRequest, async_exec: bool | None = None) SuccessResponse | SuccessAcceptedResponse¶
Execute this code bundle.
- Parameters:
execute_code_bundle_request (ExecuteCodeBundleRequest) – The execution specification, including the entry point to run (
entrypoint). (required) The bundle configuration captured when the bundle was created is used by default; it can be overridden inline through the request’sspecificationfield, a typedCodeBundleSpecificationwrapping aBundleSpec(a plaindictof the same shape is still accepted).async_exec (bool, optional) – Whether the code bundle should be executed asynchronously on the server. When
True, the server accepts the execution and returns aSuccessAcceptedResponsecarrying the job id. Defaults toNone(synchronous execution on the server).
- Returns:
A
SuccessResponsewhen the execution completes synchronously, or aSuccessAcceptedResponse(with thejob_id) when the server accepts it for asynchronous processing.- Return type:
Examples
Executing a code bundle:
Overriding the bundle configuration with a typed, inline specification:
- execute_async(execute_code_bundle_request: ExecuteCodeBundleRequest, async_exec: bool | None = None) PollingOperation[SuccessResponse | SuccessAcceptedResponse]¶
An asynchronous version of
execute().Refer to
PollingOperationfor more information on asynchronous execution and the return type.
- fetch() CodeBundle¶
Fetch a code bundle.
- fetch_async() PollingOperation[CodeBundle]¶
An asynchronous version of
fetch().Refer to
PollingOperationfor more information on asynchronous execution and the return type.