snowflake.core.procedure.ProcedureResource

class snowflake.core.procedure.ProcedureResource(name_with_args: Annotated[str, Strict(strict=True)], collection: ProcedureCollection)

Bases: SchemaObjectReferenceMixin[ProcedureCollection]

Represents a reference to a Snowflake procedure.

With this procedure reference, you can create and fetch information about procedures, as well as perform certain actions on them.

Attributes

database
fully_qualified_name
root

Methods

call(call_argument_list: CallArgumentList | None = None) Any

Call this procedure.

Examples

Calling a procedure with no arguments using its reference:

>>> procedure_reference.call(call_argument_list=CallArgumentList(call_arguments=[]))
Copy

Calling a procedure with 2 arguments using its reference:

>>> procedure_reference.call(call_argument_list=CallArgumentList(call_arguments=[
...     CallArgument(name="id", datatype="NUMBER", value=1),
...     CallArgument(name="tableName", datatype="VARCHAR", value="my_table_name"),
... ]))
Copy
drop(if_exists: bool = False) None

Drop this procedure.

Parameters:

if_exists (bool, optional) – Whether to error if the procedure doesn’t exist. Default is False.

Examples

Dropping a procedure using its reference, erroring if it doesn’t exist:

>>> procedure_reference.drop()
Copy

Dropping a procedure using its reference, if it exists:

>>> procedure_reference.drop(if_exists=True)
Copy
fetch() Procedure

Fetch the details of a procedure.

Examples

Fetching a reference to a procedure to print its name:

>>> my_procedure = procedure_reference.fetch()
>>> print(my_procedure.name)
Copy
Language: English