Influxdb3-python query doesn't include time zone information

Hi,

when I enter the following query in the Data Explorer:

SELECT time, average_power
FROM metrics
WHERE time BETWEEN '2024-06-30T22:00:00+0000' AND '2024-07-31T22:00:00+0000'
ORDER BY time ASC

I get this result:

|average_power (double)|time (dateTime:RFC3339)|
|199.4|2024-06-30T22:00:40.000Z|
...

However, when I use the same query in my Python code using influxdb3-python

influxClient = InfluxDBClient3(host=f"eu-central-1-1.aws.cloud2.influxdata.com",
                               database=f"prod",
                               token=f"abcdef")
query = ("SELECT time, average_power \
              FROM metrics \
              WHERE time BETWEEN '2024-06-30T22:00:00+0000' AND '2024-07-31T22:00:00+0000' \
              ORDER BY time ASC \
            ")

table = influxClient.query(query=query, language="sql")
print(table)

I get this:

time: [[2024-06-30 22:00:40.000000000, ...]]
average_power: [[199.4, ...]]

Note that the result in the Python version leaves out the time zone information. That’s an issue I haven’t found the root cause of. Is that a bug? Do I need to do something different?

Thanks!

The Data Explorer UI shows timestamps in RFC3339 format with explicit timezone (UTC/Z) and the Python client returns timestamps as native Python datetime objects, which are timezone-naive by default. This is not a bug. You can handle time zone in the client side, if you have better suggestions/feedback always welcome to Open GitHub issue with the same and even submit a pull request. Btw, here is an example of how to convert in UTC influxdb3-python/Examples/pokemon-trainer/basic-write.py at 0303b3f813b8192b80af059fd541665fad94cb38 · InfluxCommunity/influxdb3-python · GitHub