网站接入商排名,企业年金交了有好处吗,网站流量与广告费,网站建设组织目录 一、环境版本二、官方示例三、解决方案1.Python脚本运行缺少权限2. 缺少Python3运行环境 四、参考借鉴 一、环境版本
环境版本docker clickhouse22.3.10.22
docker pull clickhouse/clickhouse-server:22.3.10.22二、官方示例
官网文档
test_function使用 XML 配置创建… 目录 一、环境版本二、官方示例三、解决方案1.Python脚本运行缺少权限2. 缺少Python3运行环境 四、参考借鉴 一、环境版本
环境版本docker clickhouse22.3.10.22
docker pull clickhouse/clickhouse-server:22.3.10.22二、官方示例
官网文档
test_function使用 XML 配置创建。文件test_function.xml/etc/clickhouse-server/test_function.xml使用默认路径设置。
functionsfunctiontypeexecutable/typenametest_function_python/namereturn_typeString/return_typeargumenttypeUInt64/typenamevalue/name/argumentformatTabSeparated/formatcommandtest_function.py/command/function
/functionsuser_scripts文件夹内的脚本文件test_function.py/var/lib/clickhouse/user_scripts/test_function.py使用默认路径设置。
#!/usr/bin/python3import sysif __name__ __main__:for line in sys.stdin:print(Value line, end)sys.stdout.flush()询问
SELECT test_function_python(toUInt64(2));报错
Code: 75. DB::ErrnoException: Cannot write into pipe , errno: 32, strerror: Broken pipe: While executing TabSeparatedRowOutputFormat: While processing test_function_python(toUInt64(2)). (CANNOT_WRITE_TO_FILE_DESCRIPTOR) (version 22.3.10.22 (official build)) , server ClickHouseNode [urihttp://localhost:8123/default, options{custom_http_paramssession_idDataGrip_3dcf30c1-e0d2-4f93-8c21-7fc99420db96}]-1444910710执行
SYSTEM RELOAD FUNCTIONS;
SELECT * FROM system.functions WHERE name test_function_python;发现函数已添加却依旧运行报错
三、解决方案
1.Python脚本运行缺少权限
chmod ax /var/lib/clickhouse/user_scripts/test_function.py2. 缺少Python3运行环境
官方镜像中缺少Python3运行环境需单独安装
apt update
apt install python3四、参考借鉴
Github Issues