I'm trying this query from Grafana and it works perfectly: SELECT * FROM "x" WHERE time > '2020-03-31' AND time < '2020-04-02'
The problem is, in python I have to format the query as a string, and I run into the following problems:
1) if I use double quotes around the whole line, I get invalid syntax because the FROM field requires double quotes already (and I get influxdb.exceptions.InfluxDBClientError: 400 if I try to use single quotes around the FROM field)
2) if I use single quotes around the whole line, it sees the dates as int and returns invalid syntax
3) if I don't use quotes at all around the whole line, I get invalid syntax
4) if I use single double quotes around the dates it returns 0 elements
5) if I use single quotes and wrap dates with str() I get either 0 elements or syntax error depending if still use quotes inside the str() or not
6) if I try to wrap the whole line in str() I get syntax error
I tried all of those with both: result = client.query(q, chunked=True).get_points() result = list(client.query(q, chunked=True).get_points())
I'd prefer to use the list if possible. InfluxDB 1.7.9, Influx Python Client 5.2.3, Python 3.7, MacOs 10.12.6