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¶

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

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
call_async(call_argument_list: CallArgumentList | None = None) → PollingOperation[Any]¶

An asynchronous version of call().

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

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
drop_async(if_exists: bool = False) → PollingOperation[None]¶

An asynchronous version of drop().

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

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
fetch_async() → PollingOperation[Procedure]¶

An asynchronous version of fetch().

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