Inserting array of points in a single write using python influxdb_client_3 not working

Hello,

# Running on almalinux
(.venv) [vagrant@localhost latest]$ ./influxdb3 --version
influxdb3 3.1.0, revision 482dd8aac580c04f37e8713a8fffae89ae8bc264

I am trying to insert multiple points at once using python in a single write by means of the schedule trigger (every 5m).

Looking at the documentation for influxdb_client_3 write:

InfluxDBClient3.write

Writes a record or a list of records to InfluxDB.

Parameters

  • record (record or list): A record or list of records to write. A record can be a Point object, a dict that represents a point, a line protocol string, or a DataFrame.

It indicates that the record parameter can take a list of points - but I am noticing that whenever I invoke the write with a list of points, only one point is being created, the very last one. The program that I have written to test this is as follows:

#!/usr/bin/env python3

from influxdb_client_3 import Point, InfluxDBClient3
from datetime import datetime

def process_scheduled_call(influxdb3_local, call_time, args=None):
    points = list()
    for i in range(10):
        point = Point("home").tag("room", "Kitchen").field("temp", 21.5).field("hum", i)
        points.append(point)

    with InfluxDBClient3(host=f"http://127.0.0.1:8181",
                             database=f"mymetrics",
                             token="apiv3_C1GRsLP9rwhhKgc35UMTCO9fJfmv9dM0LXbJcqwEnuadI0pHNt--8hRa1wOJMW0k-J3mZIKlIumVprfn2pK28A") as client:
        client.write(points)

From the output below you can see that hum only shows the value of 9, where I was expecting to see 10 rows with the hum value shown from 0-9.

(.venv) [vagrant@localhost latest]$ ./influxdb3 query --host http://localhost:8181 --database mymetrics --token ${MYTOKEN} "select * from home order by time"
+-----+---------+------+-------------------------------+
| hum | room    | temp | time                          |
+-----+---------+------+-------------------------------+
| 9   | Kitchen | 21.5 | 2025-06-15T13:30:00.031321967 |
| 9   | Kitchen | 21.5 | 2025-06-15T13:35:00.009734678 |
| 9   | Kitchen | 21.5 | 2025-06-15T13:40:00.012950666 |
| 9   | Kitchen | 21.5 | 2025-06-15T13:45:00.016408837 |
| 9   | Kitchen | 21.5 | 2025-06-15T13:50:00.014682968 |
| 9   | Kitchen | 21.5 | 2025-06-15T13:55:00.015578279 |
| 9   | Kitchen | 21.5 | 2025-06-15T14:00:00.013806979 |
| 9   | Kitchen | 21.5 | 2025-06-15T14:05:00.006781452 |
| 9   | Kitchen | 21.5 | 2025-06-15T14:10:00.012360783 |
| 9   | Kitchen | 21.5 | 2025-06-15T14:15:00.014129560 |
+-----+---------+------+-------------------------------+

On the other hand if I change the code to write a single point at the time:

from influxdb_client_3 import Point, InfluxDBClient3
from datetime import datetime


def process_scheduled_call(influxdb3_local, call_time, args=None):

    points = list()
    for i in range(10):
        point = Point("home").tag("room", "Kitchen").field("temp", 21.5).field("hum", i)
        points.append(point)

    with InfluxDBClient3(host=f"http://127.0.0.1:8181",
                             database=f"mymetrics",
                             token="apiv3_C1GRsLP9rwhhKgc35UMTCO9fJfmv9dM0LXbJcqwEnuadI0pHNt--8hRa1wOJMW0k-J3mZIKlIumVprfn2pK28A") as client:
        for p in points:
            print(f"{datetime.now()} writting point...")
            client.write(p)

I can see that all points are being created - but with rather a huge delay, taking about 8 seconds to write 10 points individually:

(.venv) [vagrant@localhost latest]$ ./influxdb3 query --host http://localhost:8181 --database mymetrics --token ${MYTOKEN}
 "select * from home order by time"
+-----+---------+------+-------------------------------+
| hum | room    | temp | time                          |
+-----+---------+------+-------------------------------+
| 0   | Kitchen | 21.5 | 2025-06-15T14:40:00.010867295 |
| 1   | Kitchen | 21.5 | 2025-06-15T14:40:00.851427535 |
| 2   | Kitchen | 21.5 | 2025-06-15T14:40:01.850041324 |
| 3   | Kitchen | 21.5 | 2025-06-15T14:40:02.849303571 |
| 4   | Kitchen | 21.5 | 2025-06-15T14:40:03.849634706 |
| 5   | Kitchen | 21.5 | 2025-06-15T14:40:04.850275765 |
| 6   | Kitchen | 21.5 | 2025-06-15T14:40:05.849237392 |
| 7   | Kitchen | 21.5 | 2025-06-15T14:40:06.849934686 |
| 8   | Kitchen | 21.5 | 2025-06-15T14:40:07.850975463 |
| 9   | Kitchen | 21.5 | 2025-06-15T14:40:08.849148669 |

Any ideas what is that I may be doing wrong?

Thank you and best regards.

So,

It appears to me that the issue is with the fact of not posting the time attribute which ensures that there is a different timestamp within the record, after I force a timestamp (which causes a slight delay, due to invoking the datetime.now() method), it seems that things work…Although, why would influx db have a requirement that the timestamp be different among records in the same table (aka, measurement?) …

In any case this seems to have resolved the issue and things seem to be recording at a much faster rate…

from influxdb_client_3 import Point, InfluxDBClient3
from datetime import datetime


def process_scheduled_call(influxdb3_local, call_time, args=None):
    points = list()
    for i in range(10):
        point = Point("home").tag("room", "Kitchen").field("temp", 21.5).field("hum", i).time(datetime.now())
        points.append(point)

    with InfluxDBClient3(host=f"http://127.0.0.1:8181",
                             database=f"mymetrics",
                             token="apiv3_C1GRsLP9rwhhKgc35UMTCO9fJfmv9dM0LXbJcqwEnuadI0pHNt--8hRa1wOJMW0k-J3mZIKlIumVprfn2pK28A") as client:
        print(f"{datetime.now()} About to write to DB...")
        client.write(points)

Here are the results:

(.venv) [vagrant@localhost latest]$ ./influxdb3 query --host http://localhost:8181 --database mymetrics --token ${MYTOKEN} "select * from home order by time"
+-----+---------+------+----------------------------+
| hum | room    | temp | time                       |
+-----+---------+------+----------------------------+
| 0   | Kitchen | 21.5 | 2025-06-15T19:15:00.009600 |
| 1   | Kitchen | 21.5 | 2025-06-15T19:15:00.009618 |
| 2   | Kitchen | 21.5 | 2025-06-15T19:15:00.009626 |
| 3   | Kitchen | 21.5 | 2025-06-15T19:15:00.009632 |
| 4   | Kitchen | 21.5 | 2025-06-15T19:15:00.009638 |
| 5   | Kitchen | 21.5 | 2025-06-15T19:15:00.009644 |
| 6   | Kitchen | 21.5 | 2025-06-15T19:15:00.009649 |
| 7   | Kitchen | 21.5 | 2025-06-15T19:15:00.009654 |
| 8   | Kitchen | 21.5 | 2025-06-15T19:15:00.009659 |
| 9   | Kitchen | 21.5 | 2025-06-15T19:15:00.009664 |
+-----+---------+------+----------------------------+

I notice the transact is withing the same sacond at the millisec level.
.