From 20453e084f5fb3e88825752b09f24adb525a02d3 Mon Sep 17 00:00:00 2001 From: David Hoese <david.hoese@ssec.wisc.edu> Date: Wed, 4 Oct 2023 09:43:48 -0500 Subject: [PATCH] Fix handling of multi-instrument queries --- metobsapi/util/query_influx.py | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/metobsapi/util/query_influx.py b/metobsapi/util/query_influx.py index 49a5468..b008e9b 100644 --- a/metobsapi/util/query_influx.py +++ b/metobsapi/util/query_influx.py @@ -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] diff --git a/pyproject.toml b/pyproject.toml index 7d886db..d4f872f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [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] -- GitLab