Skip to content

Commit

Permalink
Merge pull request #6 from frli4797/d1
Browse files Browse the repository at this point in the history
Increasing some debugging and more type safety
  • Loading branch information
frli4797 authored Sep 9, 2024
2 parents 594abb4 + fcecfb1 commit 92f80df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions influxv2tovm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 92f80df

Please sign in to comment.