snowflake.core.task.StoredProcedureCall | Snowflake Documentation (original) (raw)
class snowflake.core.task.StoredProcedureCall(func: Callable[[...], Any] | StoredProcedure, *, args: list[Any] | None = None, return_type: DataType | None = None, input_types: list[DataType] | None = None, stage_location: str | None = None, imports: list[str | tuple[str, str]] | None = None, packages: list[str | ModuleType] | None = None)¶
Bases: object
Represents a procedure call used as a task’s definition
.
Parameters:
- func (Union [ Callable [ ... , Any ] , StoredProcedure ]) –
When it’s aCallable
, typically a function, an anonymous stored procedure will be created as the Task’s definition by using thisCallable
. Note that the first parameter of your function should be a snowpark Session.
When it’s aStoredProcedure
, it will be converted to a SQL to call an existing stored procedure. TheStoredProcedure
must be a permanent one instead of a temporary one because a Task will run in a different session than the session that creates the Task. A temporary one won’t be accessible from that session that runs the Task. - args (list [ Any ] , optional) – The arguments to call the stored procedure when
func
is aStoredProcedure
. - return_type (DataType , optional) – A
DataType
representing the return data type of the stored procedure. Optional if type hints are provided. - input_types (list [ DataType ] , optional) – A list of
DataType
representing the input data types of the stored procedure. Optional if type hints are provided. - stage_location (str , optional) – The stage location where the Python file for the anonymous stored procedure and its dependencies should be uploaded. It must be a permanent location because a Task will run in a different session than the session that creates the Task. A temporary one won’t be accessible from that session that runs the Task.
- imports (list [ Union [ str , Tuple [ str , str ] ] ] , optional) – A list of imports that only apply to this stored procedure. You can use a string to represent a file path (similar to the
path
argument inadd_import()
) in this list, or a tuple of two strings to represent a file path and an import path (similar to theimport_path
argument inadd_import()
). These stored procedure-level imports will override the session-level imports added byadd_import()
. - packages (list [ Union [ str , ModuleType ] ] , optional) – A list of packages that only apply to this stored procedure. These stored procedure-level packages will override the session-level packages added by
add_packages()
andadd_requirements()
.