-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
This is my use case:
I have a table which has a JSON column. For some of the possible JSON values, I want to enforce a specific type. This is an example:
CREATE TABLE json_nested
(
`user_id` UInt32,
`data` JSON(attributes JSON(timestamp UInt64))
)
ENGINE = MergeTree
PRIMARY KEY (user_id)
ORDER BY (user_id)
SETTINGS index_granularity = 8192
;
With that, I want to be able to insert any JSON data, but for attributes.timestamp it should be parsed as UInt64. I've been using this to insert data using the Node Clickhouse client, with JSONEachRow, and it works as expected.
Now, using ecto_ch, I get this error:
** (Ch.Error) Code: 117. DB::Exception: Type of 'data' must be JSON(attributes JSON(timestamp UInt64)), not JSON: (while reading header): While executing BinaryRowInputFormat. (INCORRECT_DATA) (version 25.9.3.48 (official build))
I added the sample test code here: https://github.com/fabiokr/ecto_ch/blob/nested-json/test/ecto/integration/json_nested_test.exs
ecto_ch uses BinaryRowInputFormat, which seems to be more strict. Is there a way around this? Could we possibly allow insert using JSONEachRow instead?
Metadata
Metadata
Assignees
Labels
No labels