-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
wontfixThis will not be worked onThis will not be worked on
Milestone
Description
It seems that there may be issues with passing params with query_data_frame(). See below code example:
client = InfluxDBClient(url="localhost:5000", token="", timeout=100000, retries=0, enable_gzip=True, profilers="query, operator")
query_api = client.query_api()
ver = "data" # This variable would come from a function
p = {
"_pVersion": ver,
}
df = query_api.query_data_frame('''from(bucket:"db")
|> range(start: -200d)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> filter(fn: (r) => r._measurement == "test_result")
|> filter(fn: (r) => r.version == _pVersion)
|> keep(columns: ["_time", "test", "run", "status_tag", "duration_sec", "version"])''',
params=p
)Expected behavior:
I expect that this query would run as if I was passing the variable inline. like such:
client = InfluxDBClient(url="localhost:5000", token="", timeout=100000, retries=0, enable_gzip=True, profilers="query, operator")
query_api = client.query_api()
ver = "data" # This variable would come from a function
df = query_api.query_data_frame(f'''from(bucket:"db")
|> range(start: -200d)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> filter(fn: (r) => r._measurement == "test_result")
|> filter(fn: (r) => r.version == "{ver}")
|> keep(columns: ["_time", "test", "run", "status_tag", "duration_sec", "version"])'''
)Actual behavior:
I am getting the below error:
HTTP response body: b'{"error":"type error 5:67-5:76: undefined identifier \\"_pVersion\\""}\n'
Specifications:
- Client Version: 1.19.0
- InfluxDB Version: 1.8.6
- Platform: MacOS
Please see my Stackoverflow post for additional data: https://stackoverflow.com/questions/68385739/using-params-in-flux-queries-with-python-influxdb-client?noredirect=1#comment120860080_68385739
bl-ue
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on