# Select Into problems

**URL:** <https://community.influxdata.com/t/select-into-problems/8837>\
**Category:** Telegraf\
**Tags:** chronograf\
**Created:** [March 1, 2019, 9:37am UTC](https://community.influxdata.com/t/select-into-problems/8837 "2019-03-01T09:37:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgg](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mgg](https://community.influxdata.com/u/mgg)\
**Post date:** [March 1, 2019, 9:37am UTC](https://community.influxdata.com/t/select-into-problems/8837/1 "2019-03-01T09:37:20Z")

</div>

Hello,  
I’ve a problem aggregation data in the Influxdb.

There is a table with massive measurments within a resolution about 5 seconds. And I want to aggregate the data so i will get a resolution of 1 minute.  
This is the query:

“SELECT mean(value) AS avg, min(value) AS min, max(value) AS max, count(value) AS count, sum(value) AS sum  
INTO monitor.rp\_minute.facts  
FROM monitor.rp\_sekunde.facts  
WHERE wert\_id = ‘2117’  
AND time \>= ‘2019-02-23 12:00:00’  
AND time \<= ‘2019-02-23 13:00:00’  
GROUP BY time(1m), wert\_id  
fill(none)”

The strange problem ist that if i send the query with the chronograph it works. But if i send it from the python application there is no data in rp\_minute.facts. I can see that the query which is send by python arrives at the influxdb (seen with “show queries”) and the syntax is correct.  
I’ve checked the database connection twice.

I use the " InfluxDB-Python" Library. On an Ubuntu LTS 18.04.  
Influxdb-Version: 1.7.4

And at this point i’ve no clue how to debug this problem.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [March 1, 2019, 1:03pm UTC](https://community.influxdata.com/t/select-into-problems/8837/2 "2019-03-01T13:03:29Z")

</div>

Hi ,

to help you debug I have some questions 🙂

do you have some more details from your python script ,  
what is the syntax that you found with show queries ?  
I assume you have to execute this query only once and then you will use  
a continuous query to do the aggregation of new data ?  
So you can achieve the same result without using python ?  
best regards

---

<div class="post-metadata">

**Author:** ![mgg](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mgg](https://community.influxdata.com/u/mgg)\
**Post date:** [March 1, 2019, 1:12pm UTC](https://community.influxdata.com/t/select-into-problems/8837/3 "2019-03-01T13:12:01Z")

</div>

Hi Marc,

Thank you for your answer!

Here are my answers:

- Python assembles the query you can see in my first post. I think python isn’t the problem because the query arrives in finlux as shown in the first post.
- A continous query doesn’t fit on my conditions. Some times the data that is imported is a few days or weeks old. So i need to aggregate the data which was imported before.

regards

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [March 1, 2019, 1:24pm UTC](https://community.influxdata.com/t/select-into-problems/8837/4 "2019-03-01T13:24:49Z")

</div>

Maybe some silly questions now …  
How did you check if it worked or not after running the python script ?  
Did you check in the same way after running it with chronograf ?  
What is the result when you execute the query in influx cli ?

---

<div class="post-metadata">

**Author:** ![mgg](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mgg](https://community.influxdata.com/u/mgg)\
**Post date:** [March 1, 2019, 1:39pm UTC](https://community.influxdata.com/t/select-into-problems/8837/5 "2019-03-01T13:39:01Z")

</div>

I look with the chronograph if there is any data in the “rp\_minute.facts”. And yes I check it in the same way.  
I didn’t test it with the cli, I think that would be the same result as the way with the chronograph.

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [March 1, 2019, 2:10pm UTC](https://community.influxdata.com/t/select-into-problems/8837/6 "2019-03-01T14:10:33Z")

</div>

Do you have errors in the logfiles ?  
Do you find something in journalctl -u influxdb ?

---

<div class="post-metadata">

**Author:** ![mgg](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mgg](https://community.influxdata.com/u/mgg)\
**Post date:** [March 1, 2019, 2:59pm UTC](https://community.influxdata.com/t/select-into-problems/8837/7 "2019-03-01T14:59:49Z")

</div>

I didn’t find any specific influx log file.

These are examples from the syslog:

Mar 1 14:55:09 el-smart-influx influxd[1656]: [httpd] 172.16.3.51 - influx [01/Mar/2019:14:55:09 +0000] “GET /query?db=monitor&q=SELECT+mean%28%22value%22%29+AS+%22avg%22%2C+min%28%22value%22%29+AS+%22min%22%2C+max%28%22value%22%29+AS+%22max%22%2Ccount%28%22value%22%29+AS+%22count%22%2C+sum%28%22value%22%29+AS+%22sum%22+%0AINTO+%22monitor%22.%22rp\_minute%22.%22facts%22+%0AFROM+%22monitor%22.%22rp\_sekunde%22.%22facts%22+%0AWHERE+%22wert\_id%22%3D%272575%27+AND+time+%3E%3D+%272018-12-08+02%3A16%3A00%27+AND+time+%3C%3D+%272018-12-08+02%3A32%3A00%27+%0AGROUP+BY+time%281m%29%2C+wert\_id+FILL%28none%29 HTTP/1.1” 200 377 “-” “python-requests/2.9.1” 01fa4a27-3c32-11e9-96a5-005056bd2003 7933

Mar 1 14:58:31 el-smart-influx influxd[1792]: ts=2019-03-01T14:58:31.972109Z lvl=info msg=“Executing query” log\_id=0DvS11pG000 service=query query=“SELECT mean(value) AS avg, min(value) AS min, max(value) AS max, count(value) AS count, sum(value) AS sum INTO monitor.rp\_minute.facts FROM monitor.rp\_sekunde.facts WHERE wert\_id = ‘2986’ AND time \>= ‘2019-03-01 12:04:00’ AND time \<= ‘2019-03-01 12:16:00’ GROUP BY time(1m), wert\_id fill(none)”

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [March 1, 2019, 3:27pm UTC](https://community.influxdata.com/t/select-into-problems/8837/8 "2019-03-01T15:27:09Z")

</div>

is it possible that you use a different wert\_id in the were clause in chronograf and python ?

---

<div class="post-metadata">

**Author:** ![mgg](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mgg](https://community.influxdata.com/u/mgg)\
**Post date:** [March 1, 2019, 3:28pm UTC](https://community.influxdata.com/t/select-into-problems/8837/9 "2019-03-01T15:28:32Z")

</div>

Thats not possible, I’ve checked that several times.

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [March 1, 2019, 3:32pm UTC](https://community.influxdata.com/t/select-into-problems/8837/10 "2019-03-01T15:32:44Z")

</div>

or a different date ? because in the output you showed :  
wert\_id%22%3D%27 **2575** %27+AND+time+%3E%3D+%27 **2018-12-08** +02%3A16%3A00%27+AND+time+%3C%3D+%27 **2018-12-08** +02%3A32%3A00%27+%0AGROUP+BY+time%281m%29%2C+wert\_id+FILL%28none%29 HTTP/1.1” 200 377 “-” “python-requests/2.9.1” 01fa4a27-3c32-11e9-96a5-005056bd2003 7933

I see wert\_id= 2575 , and the date is 2018 …
