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
constquery='INSERT INTO analytics (id, pid, pg, dv, br, os, lc, ref, so, me, ca, lt, cc, unique, created)'awaitclickhouse.query(query,data).toPromise()
The table schema
CREATETABLEIF NOT EXISTS analytics.analytics
(
id UUID,
pid FixedString(12),
pg Nullable(String),
dv Nullable(String),
br Nullable(String),
os Nullable(String),
lc Nullable(String),
ref Nullable(String),
so Nullable(String),
me Nullable(String),
ca Nullable(String),
lt Nullable(UInt16),
cc Nullable(FixedString(2)),
unique UInt8,
created DateTime
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(created)
ORDER BY (id, created, pid);
When I execute the query above, the data is stored like this (instead of null it stores the column as an empty string):
I want it to be stored as null.
Instead of JavaScript null I tried supplying something like '\N', '\0', 'NULL' - none of this seems to work like I want it to.
Is there a way to insert null-able values via the prepared statements? If yes, how?
The text was updated successfully, but these errors were encountered:
awaitch.query(`alter table asset update class_id = {class_id:Nullable(UInt32)} where id = {id:String}`,{params: {id: 'test',class_id: null}}).toPromise()
I get this error
TypeError: Cannot read properties of null (reading 'toString')
at ./node_modules/clickhouse/index.js:499:32
https://github.com/TimonKK/clickhouse/blob/master/index.js#L499
Perhaps this line can change to whatever syntax is needed for null via http? I've had a look through the clickhouse documentation and I can't understand how to pass a null value correctly. I've tried 'Null' and '' (empty string) which don't work.
I'm trying to insert some value into table via the prepared statement feature, similarly to this.
This is the array of data I'm trying to insert (some of the values are JSON null)
The query itself looks like this
The table schema
When I execute the query above, the data is stored like this (instead of
null
it stores the column as an empty string):I want it to be stored as
null
.Instead of JavaScript
null
I tried supplying something like '\N', '\0', 'NULL' - none of this seems to work like I want it to.Is there a way to insert
null
-able values via the prepared statements? If yes, how?The text was updated successfully, but these errors were encountered: