I've encountered the same behavior several times when querying InfluxDB2 from Python (3.8) using the influxdb_client (1.36.1). For example, the query:
query = f'\
from(bucket: "my_bucket")\
|> range(start: -2d, stop: -1d )\
|> filter(fn: (r) => r["_measurement"] == "my_measurement")\
|> filter(fn: (r) => (r["_field"] == "my_field"))\
|> map(fn:(r)=>({r with _value: r._value / 3.0}))\
|> last()\
'
yields:
File "<fstring>", line 1
(r with _value)
^
SyntaxError: invalid syntax
I know the Flux query is correct, as when I type the same query for example in Grafana or in InfluxDB directly, there is no problem. Can anyone reproduce the case ?