UDF Output Logger#
The Pytest SLC Plugin helps accessing and analyzing the output of UDFs (User Defined Functions), see docs.exasol.com.
Since UDFs cannot print to your console, you can only retrieve messages from
UDFs via network transfer, e.g. using sockets. PYTSLC class
UdfOutputLogger can redirect output from UDFs to your local console or
wait for specific messages.
The class can be used as a context with the following arguments:
Argument |
Default value and alternatives |
|---|---|
|
|
|
Default: |
|
Default: |
The following minimal example uses pyexasol_query_func() and prints the
UDF output to stdout.
from exasol.pytest_slc import udf_debug as ud
query = ud.pyexasol_query_func(pyexasol_connection)
with ud.UdfOutputLogger(query):
query("SELECT print_something() FROM DUAL")
Here is an example, using a LogPipe and waiting for a specific message.
LogPipe#from exasol.pytest_slc import udf_debug as ud
query = ud.pyexasol_query_func(pyexasol_connection)
pipe = ud.LogPipe()
with ud.UdfOutputLogger(query, print_func=pipe.input):
query("SELECT print_something() FROM DUAL")
ud.wait_for_messages(pipe.output, "Hello from UDF")
Function wait_for_messages() has the following arguments:
Argument |
Default value and alternatives |
|---|---|
|
Function to retrieve new messages, use |
|
One or multiple messages of type |
|
Default: 10 seconds. |