snowflake.core.user_defined_function.UserDefinedFunctionResource¶

class snowflake.core.user_defined_function.UserDefinedFunctionResource(name_with_args: str, collection_class: UserDefinedFunctionCollection)¶

Bases: UserDefinedFunctionResourceBase

Represents a reference to a Snowflake user defined function.

With this user defined function reference, you can fetch information about a user defined function, as well as perform certain actions on 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

drop(if_exists: bool | None = None) → None¶

Delete a UDF.

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 PollingOperation for more information on asynchronous execution and the return type.

fetch() → UserDefinedFunction¶

Fetch a UDF.

fetch_async() → PollingOperation[UserDefinedFunction]¶

An asynchronous version of fetch().

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

rename(target_name: str, target_database: str | None = None, target_schema: str | None = None, if_exists: bool | None = None) → None¶

Rename this user defined function.

Parameters:
  • target_name (str) – The new name of the user defined function

  • target_database (str, optional) – The database where the user defined function will be located

  • target_schema (str, optional) – The schema where the user defined function will be located

  • if_exists (bool, optional) – Check the existence of user defined function before rename

Examples

Renaming this user defined function using its reference:

>>> user_defined_function_reference.rename("my_other_user_defined_function")
Copy

Renaming this user defined function if it exists:

>>> user_defined_function_reference.rename("my_other_user_defined_function", if_exists=True)
Copy

Renaming this user defined function and relocating it to another schema within same database:

>>> user_defined_function_reference.rename(
...     "my_other_user_defined_function", target_schema="my_other_schema", if_exists=True
... )
Copy

Renaming this user defined function and relocating it to another database and schema:

>>> user_defined_function_reference.rename(
...     "my_other_user_defined_function",
...     target_database="my_other_database",
...     target_schema="my_other_schema",
...     if_exists=True,
... )
Copy
rename_async(target_name: str, target_database: str | None = None, target_schema: str | None = None, if_exists: bool | None = None) → PollingOperation[None]¶

An asynchronous version of rename().

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