I've a python script that outputs the input:
#!/usr/bin/python3
import sys
if __name__ == '__main__':
i = 0
for line in sys.stdin:
print(i, line, end='')
sys.stdout.flush()
i += 1
This script is connected to ClickHouse with this config:
<functions>
<function>
<type>executable</type>
<name>test_function_python</name>
<return_type>String</return_type>
<argument><type>Int64</type></argument>
<format>TabSeparated</format>
<command>test_function.py</command>
<execute_direct>1</execute_direct>
</function>
</functions>
The script is called from ClickHouse:
SELECT test_function_python(number) AS x
FROM numbers(5)
┌─x───┐
│ 0 0 │
│ 1 1 │
│ 2 2 │
│ 3 3 │
│ 4 4 │
└─────┘
So far so good but I want to send multiple parameters to the UDF like this:
SELECT test_function_python(number, number + 3) AS x
FROM numbers(5)
So how do I get two arguments from Python code??