snowflake.core.user_defined_function.UserDefinedFunctionCollection¶
- class snowflake.core.user_defined_function.UserDefinedFunctionCollection(schema: SchemaResource)¶
- Bases: - UserDefinedFunctionCollectionBase- Represents the collection operations on the Snowflake User Defined Function resource. - With this collection, you can create, iterate through, and fetch user defined functions that you have access to in the current context. - Examples - Creating a user defined function instance of python language: - >>> user_defined_functions.create( ... UserDefinedFunction( ... name="my_python_function", ... arguments=[], ... return_type=ReturnDataType(datatype="VARIANT"), ... language_config=PythonFunction(runtime_version="3.9", packages=[], handler="udf"), ... body=''' ... def udf(): ... return {"key": "value"} ... ''', ... ) ... ) - Attributes - database¶
- The DatabaseResource this collection belongs to. 
 - root¶
- The Root object this collection belongs to. 
 - Methods - create(user_defined_function: UserDefinedFunction, mode: CreateMode | str | None = None, copy_grants: bool | None = None) UserDefinedFunctionResource¶
- Create a UDF. - Parameters:
- user_defined_function (UserDefinedFunction) – (required) 
- mode (Union[CreateMode, str]) – Parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists: Throws an error if you try to create a resource that already exists. - orReplace: Automatically replaces the existing resource with the current one. - ifNotExists: Creates a new resource when an alter is requested for a non-existent resource. 
- copy_grants (bool) – Parameter to enable copy grants when creating the object. 
 
 
 - create_async(user_defined_function: UserDefinedFunction, mode: CreateMode | str | None = None, copy_grants: bool | None = None) PollingOperation[UserDefinedFunctionResource]¶
- An asynchronous version of - create().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - items() ItemsView[str, T]¶
 - iter(*, like: str | None = None) Iterator[UserDefinedFunction]¶
- List UDFs. - Parameters:
- like (str) – Parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. 
 
 - iter_async(*, like: str | None = None) PollingOperation[Iterator[UserDefinedFunction]]¶
- An asynchronous version of - iter().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - keys() KeysView[str]¶
 - update_reference(old_name: str, new_name: str, resource: T) None¶
- Update the collection with a new item. 
 - values() ValuesView[T]¶