influxdata / influxdb-python

Python client for InfluxDB
MIT License
1.7k stars 522 forks source link

bug: bind_params cause InfluxDBClientError: expected field argument #913

Open CunjunYin opened 2 years ago

CunjunYin commented 2 years ago

sample query client.query(query='SELECT mean( $var ) FROM "TABLE" WHERE time > $peroid GROUP BY time(10m) fill(0);', bind_params ={"var": name, "peroid":time })

ERROR: InfluxDBClientError: expected field argument in mean()

when replace $var with name everything works fine client.query(query='SELECT mean( "NAME" ) FROM "TABLE" WHERE time > $peroid GROUP BY time(10m) fill(0);', bind_params ={"var": name, "peroid":time })

DrakezulsMinimalism commented 2 years ago

bind_params is (AFAIK) only supported in the WHERE-clause, not in the SELECT. You might have to add specific field-validation instead of using bind_params for that.