create_lib_udf¶
In [ ]:
create_lib_udf(udf_list: list,
library_name: str,
include_dependencies: list = [],
file_path: str = "",
create_file: bool = False)
Generates the code needed to install a library of Python functions. It uses the Vertica SDK to create UDF of the input functions.
Parameters¶
Name | Type | Optional | Description |
---|---|---|---|
udf_list | list | ❌ | List of tuples including the different functions.
|
library_name | str | ❌ | Library Name. |
include_dependencies | list | ✓ | Library files dependencies. The function will copy paste the different files in the UDF definition. |
file_path | str | ✓ | Path to the UDF file. |
create_file | bool | ✓ | If true, instead of returning the str of the UDx, the function will create two files: one UDF .py file and one .sql file to install it. |
Example¶
In [20]:
from verticapy.udf import *
udx_str, udx_sql = create_lib_udf([(math.exp, [float], float, {}, "python_exp"),
(math.isclose, [float, float], bool, {"abs_tol": float}, "python_isclose"),],
library_name = "python_math",
create_file = False)
In [22]:
print(udx_str)
In [24]:
print("\n".join(udx_sql))