ArcticDB icon indicating copy to clipboard operation
ArcticDB copied to clipboard

get_description timezone is incorrect

Open Shrimpy48 opened this issue 1 year ago • 0 comments

Describe the bug

When a time-series symbol has a non-UTC index, the date_range returned by get_description follows the same timezone as the index, however the datetimes are marked as UTC. This means that, for example, the following code may not read the whole dataset:

date_range = library.get_description(symbol).date_range
data = library.read(symbol, date_range=date_range).data

Steps/Code to Reproduce

from arcticdb import Arctic
import pandas as pd

index = pd.to_datetime(["2024-01-01 00:00", "2024-01-01 00:01"]).tz_localize("Asia/Shanghai")
df = pd.DataFrame({'A': [1, 2]}, index=index)

ac = Arctic('s3s://...')
lib = ac['mylibrary']

lib.write('mysymbol', df)
print(lib.get_description('mysymbol').date_range)  # (datetime.datetime(2024, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2024, 1, 1, 0, 1, tzinfo=datetime.timezone.utc))

Expected Results

(Timestamp('2024-01-01 00:00:00+0800', tz='Asia/Shanghai'), Timestamp('2024-01-01 00:01:00+0800', tz='Asia/Shanghai'))

or if the result must be UTC:

(datetime.datetime(2023, 12, 31, 16, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2023, 12, 31, 16, 1, tzinfo=datetime.timezone.utc))

OS, Python Version and ArcticDB Version

Python: 3.10.14 (main, Apr 6 2024, 18:45:05) [GCC 9.4.0] OS: Linux-5.15.0-119-generic-x86_64-with-glibc2.31 ArcticDB: 4.4.3

Backend storage used

MinIO S3

Additional Context

No response

Shrimpy48 avatar Sep 11 '24 14:09 Shrimpy48