User-Defined Functions¶
User-defined functions (UDFs) in Snowpark. Please see Python UDFs for details. Furthermore, there is vectorized UDF (Please see Python UDF Batch API for details). Compared to the default row-by-row processing pattern of a normal UDF, which sometimes is inefficient, a vectorized UDF allows vectorized operations on a dataframe, with the input as a pandas DataFrame or pandas Series. In a vectorized UDF, you can operate on a batches of rows by handling pandas DataFrame or pandas Series.
- In brief, the advantages of a vectorized UDF include
The potential for better performance if your Python code operates efficiently on batches of rows.
Less transformation logic is required if you are calling into libraries that operate on pandas DataFrames or pandas arrays.
Refer to UDFRegistration
for sample code on how to create and use regular and vectorized UDF’s using Snowpark Python API.
Classes
|
Encapsulates a user defined lambda or function that is returned by |
|
Provides methods to register lambdas and functions as UDFs in the Snowflake database. |
Methods
|
Returns a |
|
Registers a Python function as a Snowflake Python UDF and returns the UDF. |
|
Registers a Python function as a Snowflake Python UDF from a Python or zip file, and returns the UDF. |
Attributes
The Python function or a tuple containing the Python file path and the function name. |
|
The UDF name. |