# Don't get all values in DB by using python

**URL:** <https://community.influxdata.com/t/dont-get-all-values-in-db-by-using-python/12893>\
**Category:** Systems\
**Tags:** windows\
**Created:** [February 4, 2020, 3:34pm UTC](https://community.influxdata.com/t/dont-get-all-values-in-db-by-using-python/12893 "2020-02-04T15:34:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Hecht](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michael_hecht/32/4317_2.png) [@Michael\_Hecht](https://community.influxdata.com/u/Michael_Hecht)\
**Post date:** [February 4, 2020, 3:34pm UTC](https://community.influxdata.com/t/dont-get-all-values-in-db-by-using-python/12893/1 "2020-02-04T15:34:40Z")

</div>

Hi,

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):  
> jsondata.append(  
> {  
> “measurement”: “NKK”,  
> “tags”: {  
> “position”: “51”,  
> },  
> “time”: datetime.now().strftime(‘%Y-%m-%dT%H:%M:%S.%fZ’),  
> “fields”: {  
> “value”: math.sin(time.time()/10.)+random.uniform(-0.1,0.1)  
> }  
> }  
> )
> 
> client.write\_points(jsondata,time\_precision=‘u’,batch\_size=100)
> 
> 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

Michael

---

<div class="post-metadata">

**Author:** ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)\
**Post date:** [February 4, 2020, 4:08pm UTC](https://community.influxdata.com/t/dont-get-all-values-in-db-by-using-python/12893/2 "2020-02-04T16:08:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Hecht](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/michael_hecht/32/4317_2.png) [@Michael\_Hecht](https://community.influxdata.com/u/Michael_Hecht)\
**Post date:** [February 4, 2020, 4:14pm UTC](https://community.influxdata.com/t/dont-get-all-values-in-db-by-using-python/12893/3 "2020-02-04T16:14:09Z")

</div>

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.
