diff --git a/metobsapi/util/query_influx.py b/metobsapi/util/query_influx.py index 49a546875c6c98793c624963205dccd5863d0ab3..b008e9bc1f6ad60f658cd8c639e2e886e56d95dd 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 7d886dbcd4b4392fe8c65bc27a63ad8d0d82f067..d4f872fc3c1e52761fbb481d3db3063278efd32c 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]