From fcecfb1446c2f60c2b655582ae532259e57170d8 Mon Sep 17 00:00:00 2001 From: frli4797 <5780904+frli4797@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:57:00 +0000 Subject: [PATCH] Increasing some debugging and more type safety. --- influxv2tovm.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/influxv2tovm.py b/influxv2tovm.py index 143d647..c8af728 100755 --- a/influxv2tovm.py +++ b/influxv2tovm.py @@ -185,6 +185,15 @@ def __find_all_measurements(self): |> first()""" timeseries: List[pd.DataFrame] = self.__query_api.query_data_frame(first_in_series) + # query_data_frame() sometimes returns a list and sometimes just a Dataframe. + # we need to ensure that we have a list. + if type(timeseries) is pd.DataFrame: + timeseries = [timeseries] + elif type(timeseries) is not List: + print(f"We have a problem. The resulting of the query is neither list nor Dataframe.") + print(f"The type is: {type(timeseries)} Object: {timeseries}") + exit(500) + measurements_and_fields = set() for df in timeseries: measurements_and_fields.update(df[self.__measurement_key].unique())