How to Set up User-defined Functions
The process for configuring the use of UDFs is as follows:
1. Specify the languages (other than SQL) that UDFs are implemented in on the installation configuration parameter ii.hostname.config.udf_languages in config.dat.
Valid values for udf_languages are:
none - No languages are available; UDFs cannot be created.
javascript - (Default) Only JavaScript UDFs are available.
python - Only Python UDFs are available.
javascript,python - Both JavaScript and Python UDFs are available.
For example:
iisetres ii.hostname.config.udf_languages javascript,python
Notes:
• If udf_languages is changed after UDFs are created, existing UDFs using the language will report an error when used in queries.
• If language support cannot be loaded for a specified language, then the database will not start and the createdb command will fail.
2. You can skip the following additional steps if you are using secure UDFs. Perform the following additional steps if you are using unsecure Python UDFs:
Linux:
a. Install Python 3.6.8 libraries using the Python 3.6.8 installer appropriate for your operating system and version.
Note: Do not change the default version of Python on your operating system. Install 3.6.8 in a separate area and tell Vector where to find the library.
b. Create a symbolic link in the /usr/lib directory of your installation, pointing libpython3.6m.so.rh-python36-1.0 to the Python 3.6.8 library to be used. For example:
ln -s /usr/lib64/libpython3.6m.so.1.0 /opt/Actian/VectorVW/ingres/lib
/libpython3.6m.so.rh-python36-1.0
c. Install Numpy. If you are using the default Python 3.6 for Vector, use the following command:
pip3 install numpy
Note: The Linux environment variable PYTHONHOME must either be empty or set to a valid path.
Windows:
d. Set the Vector environment variable UDF_PYTHONHOME to the path where Python is installed. For example:
ingsetenv UDF_PYTHONHOME C:\Python36
e. Set the Windows System environment variable PYTHONHOME in System Properties (select Control Panel, System, Advanced system settings, Environment variables, System variables) to the path where Python is installed. For example:
PYTHONHOME=C:\Python36
f. Install Numpy. If you are using the default Python 3.6 for Vector, use the following command:
pip3 install numpy
Last modified date: 06/28/2024