InfluxDB Client .... Query by time

Hello to all
Here is my code :

results = dbClient.query('select first(ENERGY_Today) from mqtt_consumer WHERE time > 1612520426016329605 ')

with a usable/correct result.

My question:
I would like to use a more readable time term, like 2021-02-05T12:00:00Z …

How do i have to format that entry so that python3 is not generating errors??


See Explore data using InfluxQL | InfluxDB OSS 1.8 Documentation


Hi Pooh

You can be sure, i have looked up for a solution in various publication incl. this but without success …

One can say i do not find the tree in the wood …

Thanks and so sorry … :thinking: :thinking:

Hi again …

in fact …this remark made me think again…

===> Note that the single quotes around the RFC3339-like date-time strings are required.

So i remembered something like backslash , escape sequence in python strings … …

> results = dbClient.query('select last(ENERGY_Today) from mqtt_consumer WHERE time < \'2021-02-04\'')

And in fact, it works now (with the format \‘2021-02-04\’)!

THANKS again Pooh