Debug UDF Script Output
This section explains how to debug the output from a UDF script.
For any UDF script and virtual schema adapter script (except LUA scripts), you can debug the output of the script by redirecting the standard output and standard error file descriptor to any socket on another machine.
Prerequisite
- Python 2.x or 3.x installed
- PyEXASOL installed if you are using Python 3.x
Procedure
For Python 2.x
If you are using Python 2.x, follow these steps to view the debug output:
- Download the UDF Debug Python script and run this script in the command line interface on the machine where you want to view the output.
-
On running this script you will see an output like the example below:
- Next, you need to activate the redirection by executing the session/system parameter
SCRIPT_OUTPUT_ADDRESS
. In the SQL client of your choice, execute the following statement: -
On successful redirection, the debug output is displayed on the terminal:
- You can disable the output redirection by setting the parameter
SCRIPT_OUTPUT_ADDRESS
to an empty value as shown below:
By running this script, a service is started on the machine where you want to view the debug output. This service listens to the specified port and displays the debug output.
Replace <host> and <port> with the IP address and port number of the server. For example, 10.242.2.21:3000.
The default port specified is 3000.
In the above example output, '10.242.2.21' is the IP address of the server that sends the output and '52698' is the VM id.
When you call a UDF script, make sure the port specified is accessible. If it is not accessible, the output address cannot be opened, and an error is displayed.
For Python 3.x
If you are using Python 3.x, you must first install PyEXASOL on your machine. You can install PyEXASOL by following the instructions provided in the PyEXASOL GitHub repository.
Next, you can activate the redirection by following the instructions provided in the UDF script output GitHub document.