Exception from backslash followed by space in field key
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia con Point.from_dict e to_line_protocol, quindi traccia come viene effettuato l’escape della chiave del campo prima che write invii il line protocol a InfluxDB. Riproduci il caso barra rovesciata-spazio dell’issue e assicurati che la serializzazione produca un line protocol valido oppure generi un errore chiaro prima dell’invio della richiesta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Specifications
- Client Version: 1.44.0
- InfluxDB Version: 2.7.6
- Platform: Linux
Code sample to reproduce problem
#!/usr/bin/env python3
from os import getenv
from influxdb_client import InfluxDBClient
from influxdb_client.client.write.point import Point
from influxdb_client.client.write_api import SYNCHRONOUS
influx_db_client = InfluxDBClient(
url="http://localhost:8086",
token=getenv("TEST_TOKEN"),
org=getenv("TEST_ORG"),
)
write_api = influx_db_client.write_api(write_options=SYNCHRONOUS)
broken_line_protocol_line = Point.from_dict(
{
"measurement": "test-measurement-1",
"tags": {"test-tag-key-X": "test-tag-value-X"},
"fields": {r"this doesnt \ work": 666},
}
).to_line_protocol()
result = write_api.write(
getenv("TEST_BUCKET", "missing"),
getenv("TEST_ORG"),
broken_line_protocol_line,
)
print(f"result: {result}")
Expected behavior
Either that the data is accepted, or that I get a clear error message that a field keys with a single backslash followed by space is unsupported by Influx. I particularly expect that I get an exception from to_line_protocol rather than that it returns something that is invalid according to Influx and that Influx rejects with "invalid field format".
This problem also arises if giving the point object directly to write rather than going via to_line_protocol, this approach just makes it clear that it can return an invalid line protocol string.
Actual behavior
influxdb_client.rest.ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json; charset=utf-8', 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': 'v2.7.6', 'X-Platform-Error-Code': 'invalid', 'Date': 'Wed, 26 Jun 2024 13:28:23 GMT', 'Content-Length': '152'})
HTTP response body: {"code":"invalid","message":"unable to parse 'test-measurement-1,test-tag-key-X=test-tag-value-X this\\ doesnt\\ \\\\ work=666i': invalid field format"}
If I remove either the slash followed by space or the space, it works.
Additional info
AFAIK Influx doesn't support field keys that have a single backslash followed by a space? I intend to replace backslash-space with double-backslash-space on my end for backwards compatibility either way, but this tripped up four people at work when they upgraded and something that used to work (albeit by subtly turning a single into a double backslash) instead blew up with an exception.
influxdb-client 1.19.0 doesn't report an error and the values end up in the database, but it ends up with double backslashes for fields and tags.
- Lingua principale
- Python
- Stelle
- 792
- Fork
- 186
- Merge medio
- 3h 2m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di influxdata/influxdb-client-python
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
influxdata/influxdb-client-python#613 · 7 commenti ·
-
Public symbols not properly exported with `py.typed` present — triggers Pylance/Pyright errors Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
influxdata/influxdb-client-python#694 · 6 reazioni ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
influxdata/influxdb-client-python#693 · 2 commenti · 1 reazione ·
-
Socks proxy support Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di influxdata/influxdb-client-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/skills#1811 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
speaches-ai/speaches#678 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
datalayer/mcp-compose#42 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
UKGovernmentBEIS/inspect_evals#2523 ·