You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parameter data format cannot be changed when assembling SQL query parameters. When parameter variables are added to the create table name and used, the " signs" on both sides of the variables cannot be removed.
#16344
Open
3 tasks done
kieryum opened this issue
Jul 18, 2024
· 2 comments
github-actionsbot
changed the title
组装SQL查询参数时参数数据形式无法被改变,当参数变量添加在 create 表名上应用时,无法去掉 变量两边的“号。
The parameter data format cannot be changed when assembling SQL query parameters. When parameter variables are added to the create table name and used, the " signs" on both sides of the variables cannot be removed.
Jul 18, 2024
Search before asking
What happened
错误:
[INFO] 2024-07-18 03:25:56.962 -0400 - prepare statement replace sql : create table xxx_x_?
PRIMARY KEY keys
as select ?,? as keys, sql parameters : {1=Property{prop='table_name', direct=IN, type=VARCHAR, value='123'}, 2=Property{prop='var_1', direct=IN, type=VARCHAR, value='23'}, 3=Property{prop='var_2', direct=IN, type=VARCHAR, value='50'}}
[ERROR] 2024-07-18 03:25:56.987 -0400 - execute sql error: Code: 62. DB::Exception: Syntax error: failed at position 20 (''123'') (line 1, col 20): '123'
PRIMARY KEY keys
as select '23','50' as keys. Expected one of: token, Dot, UUID, ON, OpeningRoundBracket, storage definition, ENGINE, PARTITION BY, PRIMARY KEY, ORDER BY, SAMPLE BY, TTL, EMPTY AS, AS, COMMENT, INTO OUTFILE, FORMAT, SETTINGS, end of query. (SYNTAX_ERROR) (version 24.5.3.5 (official build))
, server ClickHouseNode [uri=http://10.10.60.26:8123/default]@-366638818
[ERROR] 2024-07-18 03:25:57.432 -0400 - sql task error
java.sql.BatchUpdateException: Code: 62. DB::Exception: Syntax error: failed at position 20 (''123'') (line 1, col 20): '123'
PRIMARY KEY keys
as select '23','50' as keys. Expected one of: token, Dot, UUID, ON, OpeningRoundBracket, storage definition, ENGINE, PARTITION BY, PRIMARY KEY, ORDER BY, SAMPLE BY, TTL, EMPTY AS, AS, COMMENT, INTO OUTFILE, FORMAT, SETTINGS, end of query. (SYNTAX_ERROR) (version 24.5.3.5 (official build))
我的目标:
在上游节点生成参数,在下游节点上通过上游的传参动态生成数据表。发现上游数据类型无论怎么变化,下游拿到的依然时字符串带双引号。
例如:我想生成脚本:create table xxxx_${table_name} as select xxxx ; 动态参数 ${table_name} 为 1001 或者 xx_01
实际生成了create table xxxx_'1001' as select xxxx ; 或者 create table xxxx_'xx_01' as select xxxx ;
无论上游的out 出的数据是 long 还是 interger 都无法改变现状
What you expected to happen
官方文档告诉这里是可用的。
当接收到上游的数据${table_name}=xx_001 值后 , 下游在使用时可以 create table xxx_${table_name} 可以生成 create table xx_001 ...
现实是生成了 create table 'xx_001' .
How to reproduce
目前只在sql 上出现,shell 中没有出现
Anything else
No response
Version
3.2.x
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: