How to return timestamps in python

By default, it seems the CLI returns timestamps in epoch nanoseconds (or ms or s if specified with the presicion parameter when connecting to InfluxDB). The HTTP API, by default returns datetime strings in the RFC3339 format. Here, the format may be changed with the epoch query parameter. But in Python, using the influxdbclient, I find no way to specify an epoch=ms, to return timestamps as epoch milliseconds, for example. I only get RFC3339-formatted datetime strings, with rather a lot of decimals in the seconds field. I use a simple select query with RFC3339 datetime strings in a where clause. Changing these to nanosecond epoch timestamps does not affect output formatting.

Hello @Terje,

Welcome!!

What client version are you using?
FYI This is the only one that is maintained: https://github.com/influxdata/influxdb-client-python
Unfortunately I. don’t think there’s a way to specify the query precision. You can the same precision as what you write in. So if you write the data in ms precision, your query should return the data in ms precision. Can you please share your query as well the output?

Thank you,
Anais