Infinidat/infi.clickhouse_orm

DateTime64 type support

Closed this issue · 3 comments

Clickhouse support Datetime64 type, but clickhouse-orm do not support. do you consider to add support of this type to clickhouse-orm? thanks

Generally the answer is yes, I'm not sure though how to best represent DateTime64 values in Python.

Generally the answer is yes, I'm not sure though how to best represent DateTime64 values in Python.

from clickhouse-doc:
“Internally, stores data as a number of ‘ticks’ since epoch start (1970-01-01 00:00:00 UTC) as Int64. The tick resolution is determined by the precision parameter.”
maybe you can consider the same represent in python ?

Representing the value as a python int is possible, but not very convenient - you probably want to get a datetime instance and not a "number of ticks".
A suggestion - you could try to implement a DateTime64Field class and if it works well, share it as a pull request. See instructions for creating custom field types at the bottom of https://github.com/Infinidat/infi.clickhouse_orm/blob/develop/docs/field_types.md