ClickHouse不能复制粘贴多行命令
问题背景[root@kubesphere3 ~]# docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhousecatboost@c17cb7190cc1:~$ clickhouse clientClickHouse client version 19.15.2.2 (official build).Connecting to lo
·
问题背景
[root@kubesphere3 ~]# docker run -it -p 8888:8888 yandex/tutorial-catboost-clickhouse
catboost@c17cb7190cc1:~$ clickhouse client
ClickHouse client version 19.15.2.2 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 19.15.2 revision 54426.
c17cb7190cc1 :) CREATE TABLE amazon_train
Syntax error: failed at position 26 (end of query):
CREATE TABLE amazon_train
Expected one of: ON, ENGINE, AS, token, OpeningRoundBracket, Dot, storage definition
c17cb7190cc1 :) exit
Bye.
粘贴带有换行的建表命令时,每个换行都会当做是一个语句,造成执行失败
解决方案
进入ClickHouse client时加一个-m参数,复制完语句后,加一个分号表示结束
catboost@c17cb7190cc1:~$ clickhouse client -m
ClickHouse client version 19.15.2.2 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 19.15.2 revision 54426.
c17cb7190cc1 :) CREATE TABLE amazon_train
:-] (
:-] date Date MATERIALIZED today(),
:-] ACTION UInt8,
:-] RESOURCE UInt32,
:-] MGR_ID UInt32,
:-] ROLE_ROLLUP_1 UInt32,
:-] ROLE_ROLLUP_2 UInt32,
:-] ROLE_DEPTNAME UInt32,
:-] ROLE_TITLE UInt32,
:-] ROLE_FAMILY_DESC UInt32,
:-] ROLE_FAMILY UInt32,
:-] ROLE_CODE UInt32
:-] )
:-] ENGINE = MergeTree ORDER BY date;
CREATE TABLE amazon_train
(
`date` Date MATERIALIZED today(),
`ACTION` UInt8,
`RESOURCE` UInt32,
`MGR_ID` UInt32,
`ROLE_ROLLUP_1` UInt32,
`ROLE_ROLLUP_2` UInt32,
`ROLE_DEPTNAME` UInt32,
`ROLE_TITLE` UInt32,
`ROLE_FAMILY_DESC` UInt32,
`ROLE_FAMILY` UInt32,
`ROLE_CODE` UInt32
)
ENGINE = MergeTree
ORDER BY date
Ok.
0 rows in set. Elapsed: 0.012 sec.
更多推荐
已为社区贡献6条内容
所有评论(0)