diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-12-17 12:07:28 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-12-17 12:18:43 +0300 |
commit | 48bd5f88777f4dc94fd41a7dd22808ed639b985d (patch) | |
tree | 6a899d7cc8bd632073408198260a93d76f99ef32 /contrib/python/clickhouse-connect | |
parent | 3e05dc5f5c47aa8d220db7b5508cfbd4a0d8919f (diff) | |
download | ydb-48bd5f88777f4dc94fd41a7dd22808ed639b985d.tar.gz |
Intermediate changes
commit_hash:3786c4fc65af12274eea45a3ef9de6050e262ac0
Diffstat (limited to 'contrib/python/clickhouse-connect')
6 files changed, 11 insertions, 10 deletions
diff --git a/contrib/python/clickhouse-connect/.dist-info/METADATA b/contrib/python/clickhouse-connect/.dist-info/METADATA index 3d5428f0c5..774b5caa2e 100644 --- a/contrib/python/clickhouse-connect/.dist-info/METADATA +++ b/contrib/python/clickhouse-connect/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: clickhouse-connect -Version: 0.8.8 +Version: 0.8.9 Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset Home-page: https://github.com/ClickHouse/clickhouse-connect Author: ClickHouse Inc. diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py index 0c10f92064..eed7e58e36 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py @@ -1 +1 @@ -version = '0.8.8' +version = '0.8.9' diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/datatypes/temporal.py b/contrib/python/clickhouse-connect/clickhouse_connect/datatypes/temporal.py index 49899fb7c1..39bf0c070d 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/datatypes/temporal.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/datatypes/temporal.py @@ -79,9 +79,6 @@ class Date32(Date): return data_conv.read_date32_col(source, num_rows) -from_ts_tz = datetime.fromtimestamp - - class DateTimeBase(ClickHouseType, registered=False): __slots__ = ('tzinfo',) valid_formats = 'native', 'int' @@ -192,7 +189,7 @@ class DateTime64(DateTimeBase): def _read_binary_naive(self, column: Sequence): new_col = [] app = new_col.append - dt_from = datetime.fromtimestamp + dt_from = datetime.utcfromtimestamp prec = self.prec for ticks in column: seconds = ticks // prec diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/dataconv.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/dataconv.py index fc2720128d..5acc49830e 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/dataconv.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/dataconv.py @@ -28,6 +28,9 @@ def read_ipv4_col(source: ByteSource, num_rows: int): def read_datetime_col(source: ByteSource, num_rows: int, tz_info: Optional[tzinfo]): src_array = source.read_array('I', num_rows) + if tz_info is None: + fts = datetime.utcfromtimestamp + return [fts(ts) for ts in src_array] fts = datetime.fromtimestamp return [fts(ts, tz_info) for ts in src_array] diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/tools/datagen.py b/contrib/python/clickhouse-connect/clickhouse_connect/tools/datagen.py index 755f3df98e..490d852916 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/tools/datagen.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/tools/datagen.py @@ -18,7 +18,8 @@ from clickhouse_connect.datatypes.string import String, FixedString from clickhouse_connect.datatypes.temporal import Date, Date32, DateTime, DateTime64 from clickhouse_connect.driver.common import array_sizes -dt_from_ts = datetime.fromtimestamp +dt_from_ts = datetime.utcfromtimestamp +dt_from_ts_tz = datetime.fromtimestamp epoch_date = date(1970, 1, 1) date32_start_date = date(1925, 1, 1) @@ -137,7 +138,7 @@ def random_datetime(): def random_datetime_tz(timezone: tzinfo): - return dt_from_ts(int(random() * 2 ** 32), timezone).replace(microsecond=0) + return dt_from_ts_tz(int(random() * 2 ** 32), timezone).replace(microsecond=0) def random_ascii_str(max_len: int = 200, min_len: int = 0): @@ -171,7 +172,7 @@ def random_datetime64_tz(prec: int, timezone: tzinfo): u_sec = int(random() * 1000) * 1000 else: u_sec = int(random() * 1000000) - return dt_from_ts(int(random() * 4294967296), timezone).replace(microsecond=u_sec) + return dt_from_ts_tz(int(random() * 4294967296), timezone).replace(microsecond=u_sec) def random_ipv6(): diff --git a/contrib/python/clickhouse-connect/ya.make b/contrib/python/clickhouse-connect/ya.make index ab287865bd..f2bef2bd2a 100644 --- a/contrib/python/clickhouse-connect/ya.make +++ b/contrib/python/clickhouse-connect/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.8.8) +VERSION(0.8.9) LICENSE(Apache-2.0) |