influxdb-python icon indicating copy to clipboard operation
influxdb-python copied to clipboard

ResultSet.get_points does not include tags

Open biqqles opened this issue 5 years ago • 1 comments

Contrary to https://github.com/influxdata/influxdb-python/issues/214#issuecomment-346953796, ResultSet.get_points does not include tags. That's to say @samaust is still correct (which makes sense since the last release on PyPI was just before his comment).

For other people coming up against this, here is the workaround I've been using:

# we /should/ be able to pass get_points() straight to DataFrame, but contrary to the docs this doesn't
# include tags at the moment. So let's roll our own implementation
query_result = client.query(query).items()
frame = pandas.DataFrame({**tags, **next(fields)} for (measurement_name, tags), fields in query_result)
  • InfluxDB version: 1.8.2
  • InfluxDB-python version: 5.3.0
  • Python version: 3.8.2
  • Operating system version: Manjaro

biqqles avatar Sep 13 '20 13:09 biqqles

Oh, just realised I should be using influxdb-client-python. I'll have to test with that library in case the issue is simply due to an incompatibility with InfluxDB 1.8. Perhaps a note at the top of the readme for this project about the newer library would be a good idea?

biqqles avatar Sep 13 '20 14:09 biqqles