influxdb-python
influxdb-python copied to clipboard
Invalid time_precision is given
I'm currently trying to insert data into InfluxDB from within python. Until it gets to "write_points" my code works pretty well so far.
While trying to insert the values i get the error: "ValueError: Invalid time precision is given. (use 'n', 'u', 'ms', 's', 'm' or 'h')"
Here is my Code:
import random
from influxdb import InfluxDBClient
batch_size = 1000
test_client = InfluxDBClient("server", port, "user", "pw", "database")
def generate_rndnr():
points = []
for _ in range(batch_size):
points.append(random.randint(1, 1000))
return points
points= generate_rndnr()
test_client.write_points(points, "measurement", time_precision=None)
Just getting started with this library and having the same problem. It fails to run the example on the github page. Were you able to find the issue?
It is because time_precision cannot be None if you do not want timestamps just don't use it. By default the timestamps will be stored in nanoseconds.