Dynamic output parameters in Python UDF


Hello everyone,
I have written a Python UDF that produces an undefined number of columns. I want to set the output parameters dynamically (there are sometimes 1300 columns). In the run() function a dataframe is generated, where the column names and datatypes are available. I now know that the function default_output_columns() is executed before the run() function. Is there still a way to pass this dataframe to the default_output_columns() function as a parameter? Or can I somehow use the ctx object in the default_output_columns() function?

Many greetings


Community Manager
Community Manager

Good Morning Ilja,
thanks for the patience, I nudged internally to see how we quickly can reply.



Connecting Customers, Partners, Prospects and Exasolians is my passion. Apart from that I cycle, listen to music, and try to understand what all those technical discussions really mean...


Generally speaking, you have to know all columns and types before execution of run().

Exasol sever must be able to plan query ahead, and in order to plan it all output columns are required.

If you run query with UDF from remote Python script, you may be able to access config or metadata required to build column list. And you can build it using EMITS query part:

For example:

SELECT my_udf(a, b, c, d) EMITS (id DECIMAL(9,0), str VARCHAR(100), ...)
FROM ...

EMITS is generated dynamically outside of Exasol in a script which builds and runs this query.