Skip to content
Snippets Groups Projects
Verified Commit 20453e08 authored by David Hoese's avatar David Hoese
Browse files

Fix handling of multi-instrument queries

parent 8e8f2616
No related branches found
No related tags found
No related merge requests found
......@@ -204,10 +204,10 @@ def _query_influxdbv2(query_str) -> QueryResult:
client_kwargs["token"] = current_app.config["INFLUXDB_TOKEN"]
with InfluxDBClientv2(**client_kwargs) as client:
query_api = client.query_api()
data_frame = query_api.query_data_frame(query_str, data_frame_index="_time")
if len(data_frame) == 0:
data_frames = query_api.query_data_frame(query_str, data_frame_index="_time")
if len(data_frames) == 0:
return []
data_frame = data_frame.drop(columns=["result", "table"])
# TODO: Shouldn't the query result in a list?
if not isinstance(data_frames, list):
data_frames = [data_frames]
# What are the column names if we have multiple queries (tower and buoy)?
return [data_frame]
return [data_frame.drop(columns=["result", "table"]) for data_frame in data_frames]
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2", 'setuptools_scm_git_archive']
requires = ["setuptools>=60", "wheel", "setuptools_scm[toml]>=8.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment