import os from datetime import datetime, timezone from influxdb_client_3 import InfluxDBClient3, Point host = os.environ["INFLUX_HOST"] token = os.environ["INFLUX_TOKEN"] database = os.environ["INFLUX_DATABASE"] point = ( Point("weather") .tag("room", "lab") .field("temperature", 22.4) .time(datetime(2026, 1, 1, 0, 0, tzinfo=timezone.utc)) ) with InfluxDBClient3(host=host, token=token, database=database) as client: client.write(point, write_precision="s") table = client.query( """ SELECT time, room, temperature FROM weather WHERE room = 'lab' ORDER BY time """ ) for row in table.select(["time", "room", "temperature"]).to_pylist(): print(f"{row['time']} room={row['room']} temperature={row['temperature']}")