Open zhabinka opened 11 months ago
Actually, we know why it happens. It is because of this: https://github.com/balance-platform/pillar/blob/master/lib/pillar/type_convert/to_clickhouse.ex#L40
And we what to know the reasoning behind this code. It is unclear why you decided to drop milliseconds.
@yzh44yzh @zhabinka Hello!
The answer is quite simple, the DateTime64 type was added to clickhouse later than the convert function in this library.
https://github.com/balance-platform/pillar/blob/master/lib/pillar/type_convert/to_clickhouse.ex#L40 (March 2020) https://github.com/ClickHouse/ClickHouse/pull/11512 (June 2020)
What workaround I can suggest:
For Example:
Pillar.query(conn,
"INSERT INTO table (id, created_at) SELECT {id}, {created_at}",
%{id: 123, created_at: %Pillar.Arg{value: DateTime.utc_now(), target_type: :DateTime64}
)
Ok, thank you. We did number 1 and it works for us.
However, may be it is time to change something in pillar )
Okay, glad it helped!
We are not actively using clickhouse right now, so the library is not actively developing. In any case, we do not refuse support, if there are people willing to contribute, we will help, merge and publish an updated version on hex)
ok, got it
Greetings!
We encountered unexpected behavior. The data type DateTime64 allows milliseconds, but Pillar rounds it to seconds.
For example input data:
In ClickHouse it saved like:
There are may be a reason for this behavior. Can you explain why it works this way?
We have problem to build pagination based on date when we insert more than 1 records per second.