influxdata / influxdata/influxdb-client-python

Missleading warning in query "buckets()"

Offen
#568 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Python
Sterne
793
Forks
186
Ø Merge
3 Std. 2 Min.
Gemergte PRs (30 T.)
1

Beschreibung

### Specifications

* Client Version: v2.6.1
* InfluxDB Version: 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': 'v2.6.1'
* Platform: Ubuntu 22.04.2 LTS, Python 3.10.6

1. Create a client to a local influx server.
2. Query the buckets

the last step prints a warning messages that provides a non-working solution. The solution does not apply to the returned table.

### Code sample to reproduce problem

```python
>>> from influxdb_client import InfluxDBClient
>>> c = InfluxDBClient(url="http://localhost:8086", org=..., token=...);
>>> r_api = c.query_api()
>>> r_api.query_data_frame(query='buckets()')
/home/juanpi/virtual_enviroments/wabesense-data/lib/python3.10/site-packages/influxdb_client/client/warnings.py:31: MissingPivotFunction: The query doesn't contains the pivot() function.

The result will not be shaped to optimal processing by pandas.DataFrame. Use the pivot() function by:

buckets() |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")

You can disable this warning by:
import warnings
from influxdb_client.client.warnings import MissingPivotFunction

warnings.simplefilter("ignore", MissingPivotFunction)

For more info see:
- https://docs.influxdata.com/resources/videos/pivots-in-flux/
- https://docs.influxdata.com/flux/latest/stdlib/universe/pivot/
- https://docs.influxdata.com/flux/latest/stdlib/influxdata/influxdb/schema/fieldsascols/

warnings.warn(message, MissingPivotFunction)
result table name id organizationID retentionPolicy retentionPeriod
0 _result 0 _monitoring 9ff20ba199aff20d 1f4f3678a832d418 None 604800000000000
1 _result 0 _tasks 7de84af1deb77ca4 1f4f3678a832d418 None 259200000000000
2 _result 0 scratch c7902563eb5f9007 1f4f3678a832d418 None 604800000000000
```

### Expected behavior

Either the suggested solution should be correct, or no warning should be emitted.

### Actual behavior

A solution is provided that does not apply to the returned table.

### Additional info

_No response_

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die Warnung mit InfluxDBClient.query_api().query_data_frame(query='buckets()') anhand des Beispiels und untersuche das Warnverhalten rund um diesen Einstiegspunkt. Erledigt ist die Aufgabe, wenn die Warnung für dieses Ergebnis unterdrückt wird oder die vorgeschlagene Abfrage eine gültige Ergebnisform erzeugt; überprüfe die Änderung anhand der gezeigten buckets-Tabelle.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
pandas, python
Bereich
databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.