rtdip / core

Easy access to high volume, historical and real time process data for analytics applications, engineers, and data scientists wherever they are.
Apache License 2.0
46 stars 25 forks source link

Timezone aware dates when querying data #634

Open bvandekerkhof opened 10 months ago

bvandekerkhof commented 10 months ago

Describe the bug

When requesting data using e.g. the raw query function using a start and end date string which have some time zone information the correct data seems to be returned, however the EventTime returned by the query still has time zone informatio +00:00, regardless of the inputted time zone information.

To Reproduce

from rtdip_sdk.authentication.azure import DefaultAuth
from rtdip_sdk.connectors import DatabricksSQLConnection
from rtdip_sdk.queries import raw

auth = DefaultAuth().authenticate()
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token)

parameters_0 = {
    "business_unit": "{business_unit}",
    "region": "{region}", 
    "asset": "{asset_name}", 
    "data_security_level": "{security_level}", 
    "data_type": "float",
    "tag_names": ["{tag_name_1}", "{tag_name_2}"],
    "start_date": "2023-01-01T12:00:00+00:00",
    "end_date": "2023-01-31T12:00:00+00:00",
    "include_bad_data": True,
}
x_0 = raw.get(connection, parameters_0)
print(x_0)

parameters_1 = {
    "business_unit": "{business_unit}",
    "region": "{region}", 
    "asset": "{asset_name}", 
    "data_security_level": "{security_level}", 
    "data_type": "float",
    "tag_names": ["{tag_name_1}", "{tag_name_2}"],
    "start_date": "2023-01-01T12:00:00+01:00",
    "end_date": "2023-01-31T12:00:00+01:00",
    "include_bad_data": True,
}
x_1 = raw.get(connection, parameters_1 )
print(x_1)

Expected behavior

When you inspect x_0 and x_1 you can see that the data is adhering to the specified time zone, i.e. x_0[t] == x_1[t + 1 hour], However the string provided in the EventTime column shows timezone +00:00, i.e. x_0.EventTime[0] == x_1.EventTime[0] == "2023-01-01T12:00:00+00:00". Where I would expect x_0.EventTime[0] == "2023-01-01T12:00:00+00:00" and x_1.EventTime[0] == "2023-01-01T12:00:00+01:00" or "2023-01-01T11:00:00+00:00".

Installation Setup (please complete the following information):

github-actions[bot] commented 5 hours ago

This issue is stale because it has been open for 30 days with no activity.