Don't get all values in DB by using python


I’m new to InfluxDB and maybe don’t understand the special behaviour of time series data bases.

I do the following with python:

jsondata =
for i in range(1000):
“measurement”: “NKK”,
“tags”: {
“position”: “51”,
“fields”: {
“value”: math.sin(time.time()/10.)+random.uniform(-0.1,0.1)


results = client.query(‘SELECT “value” FROM “nkktable”.“autogen”.“NKK” WHERE time > now() - 1d GROUP BY “position”’)

points1 = results.get_points(tags={‘position’:‘51’})
for i,point in enumerate(points1):
print("%5i %s %f" % (i,point[‘time’], point[‘value’]))

what I get is not 1000 points but only about 50. If I select directly from database there are also only 50 values. So it seems that not all data have been stored.

What I’m doing wrong?

Best regards


I’m not an expert of python, but for what I understand you are using:
Static Measurement - That’s ok
Static Tags - This is also ok
Dynamic Time - this might be the problem
Random Fields - that’s ok

To keep it simple, if you write a point with the same Tags and Time in a Measurement you will update it’s previous value and not write a new point.
Have a look at your data before you insert them. if they share the same time (rounded to the defined precision) you are updating points over and over again.

Yes, this was the problem. Python was too fast at this point.

I now generate the time values by hand (it’s only a first test and nothing for practice) and add always a microsecond. Now all data are in. In real systems there will be a millisecond difference and if not the value can be neglected. So all is ok.

Thank you very much.