influxdb3-python
influxdb3-python copied to clipboard
No visible exception or error handling in write() function if writing fails
Specifications
- Client Version: Latest influxdb3-python 0.16.0 (installed via conda)
- InfluxDB Version: v3 (Cloud, details on request)
- Platform: Windows 11, Python 3.12.7
Code sample to reproduce problem
import os
from dotenv import load_dotenv
from influxdb_client_3 import (
InfluxDBClient3,
Point,
)
load_dotenv()
host: str = os.getenv("INFLUX_HOST")
token: str = os.getenv("INFLUX_TOKEN")
database: str = os.getenv("INFLUX_DATABASE")
print(f"Host: {host}, Token: {token}, Database: {database}")
client: InfluxDBClient3 = InfluxDBClient3(host=host, token=token, database=database)
print("Client created:", client)
point: Point = Point("temparature").field("test", 1)
print(f"Point created: {point}")
try:
client.write(point)
print("Point written")
except Exception as ex:
print("Error writing point:", ex)
Expected behavior
If writing a point fails (e.g. due to missing permissions, invalid token, or other error), an exception should be raised or at least a warning/error should be logged. This would make debugging easier and helps to quickly identify issues with writing data.
Actual behavior
Currently, the write() function does not provide any negative feedback or raise exceptions when writing fails. This makes it difficult to debug permission or connection issues and means that problems may go unnoticed until much later.
Additional info
It is suspected that missing permissions for the token caused the write to fail, but there was no exception or error returned. Improved error handling or at least logging would make the library more robust for production usage.
Thank you for your work on this library!