clickhouse-sqlalchemy
clickhouse-sqlalchemy copied to clipboard
Can't Create a clickhouse udf function By using execute method
Describe the bug I want create a udf function like below:
CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b;
But it failed; Exception came from the database says : Syntax error (Multi-statements are not allowed): failed at position 72 (end of query): ; FORMAT TabSeparatedWithNamesAndTypes. . (SYNTAX_ERROR) (version 22.2.2.1)
So I checked the source code, It seems that a subfix will be always added to the raw syntex; It turn out that my input eventually will be like:
CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b; FORMAT TabSeparatedWithNamesAndTypes
To Reproduce
sql = "CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b; "
with engine.connect() as connection:
connection.execute(sql)
Try use clickhouse+native://
schema. HTTP dialect has poor support in this package.
It works, thanks