Open vibl opened 3 years ago
I hit this issue as well. In case others do a fix is to explicitly set the format option:
const clickhouseStream = clickhouse.query(
`insert into some_table`,
{ format: "JSONEachRow" }
);
instead of:
const clickhouseStream = clickhouse.query(
`insert into some_table format JSONEachRow`,
);
I was trying to sending an INSERT query with a JSONEachRow format and any of my attempts failed.
While debugging I found two problems:
The line https://github.com/apla/node-clickhouse/blob/5ac5a8fd3dbc8a0888a3513f4d2c4e5485c68f9c/src/clickhouse.js#L272 overrides the
options.format = "JSONEachRow"
I have explicitly set. Is that on purpose? If so, why?The regexp https://github.com/apla/node-clickhouse/blob/5ac5a8fd3dbc8a0888a3513f4d2c4e5485c68f9c/src/clickhouse.js#L269 should have a
\b
on each side of the parentheses group, otherwise e.g.JSON
is matched instead ofJSONEachRow
.So:
So
options.format
ended up being set asJSON
whatever I was doing.