influxdata / influxdata/influxdb-client-python

Missleading warning in query "buckets()"

Abierto
#568 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug
Lenguaje dominante
Python
Estrellas
793
Forks
186
Merge medio
3 h 2 min
PR fusionados (30 d)
1

Descripción

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
>>> 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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce la advertencia con InfluxDBClient.query_api().query_data_frame(query='buckets()') usando el ejemplo e inspecciona el comportamiento de la advertencia alrededor de este punto de entrada. Se considera terminado cuando la advertencia se suprima para este resultado o cuando la consulta sugerida produzca una forma de resultado válida; verifica el cambio con la tabla buckets mostrada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
pandas, python
Área
databases
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.