# Error while sending data to influxDB

**URL:** <https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598>\
**Category:** General\
**Created:** [6 November 2019 16:13 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598 "2019-11-06T16:13:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![YLM](https://avatars.discourse-cdn.com/v4/letter/y/59ef9b/32.png) [@YLM](https://discourse.nodered.org/u/YLM)\
**Post date:** [6 November 2019 16:13 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598/1 "2019-11-06T16:13:31Z")

</div>

Hi,

Since I am new to node red and influxDB, I am trying to manipulate those 2 tech in order to be better with my own project.

I have created a simple flow which generate a random number (quiet simple), now that I have it, I'd like to send it my DB with influxDB.  
I have created my database inside influxDB and I got this error

> Error: A 400 Bad Request error occurred: {"error":"error parsing query: found stations, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET, KILL at line 1, char 1"}

Cannot figure out what is wrong...

Thank you for your help

Here is my flow :  
[  
{  
"id": "8ad428d.bf355d8",  
"type": "tab",  
"label": "Flow 2",  
"disabled": false,  
"info": ""  
},  
{  
"id": "5dcbbf8a.37345",  
"type": "inject",  
"z": "8ad428d.bf355d8",  
"name": "",  
"topic": "",  
"payload": "",  
"payloadType": "date",  
"repeat": "3",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"x": 190,  
"y": 140,  
"wires": [  
[  
"5df3b750.729b8"  
]  
]  
},  
{  
"id": "5df3b750.729b8",  
"type": "function",  
"z": "8ad428d.bf355d8",  
"name": "random number",  
"func": "number = Math.random()\nmsg.payload = {\n value : number\n \n}\nreturn msg;",  
"outputs": 1,  
"noerr": 0,  
"x": 400,  
"y": 220,  
"wires": [  
[  
"d565010f.4d7a"  
]  
]  
},  
{  
"id": "d565010f.4d7a",  
"type": "influxdb in",  
"z": "8ad428d.bf355d8",  
"influxdb": "a5ced9d1.00dc1",  
"name": "weather",  
"query": "stations",  
"rawOutput": false,  
"precision": "",  
"retentionPolicy": "",  
"x": 640,  
"y": 300,  
"wires": [  
  
]  
},  
{  
"id": "a5ced9d1.00dc1",  
"type": "influxdb",  
"z": "8ad428d.bf355d8",  
"hostname": "127.0.0.1",  
"port": "8086",  
"protocol": "http",  
"database": "ESSAI",  
"name": "TEST",  
"usetls": false,  
"tls": ""  
}  
]

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [6 November 2019 16:19 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598/2 "2019-11-06T16:19:34Z")

</div>

Welcome to the forum.  
You need to format your code properly, see:

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [6 November 2019 16:22 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598/3 "2019-11-06T16:22:38Z")

</div>

> error parsing query: found stations, expected SELECT

Your query:

> "query": "stations",

Should be a [`select` statement](https://docs.influxdata.com/influxdb/v1.7/query_language/data_exploration/#the-basic-select-statement), or:

Your topic title "Error while sending data to influxDB" seems to suggest that you want to "insert" it into your database, then it should be a insert query.

Also note that the influxdb nodes have lots of information when you select the node. [Additional documentation for the nodes.](https://flows.nodered.org/node/node-red-contrib-influxdb)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 November 2019 16:49 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598/4 "2019-11-06T16:49:08Z")

</div>

You have said the error is from writing data, but I suspect that it is the influx In node that is generating it. You can tell if you look carefully at the output in the debug window.  
In that node you have to provide a valid query, which it appears you have not.

---

<div class="post-metadata">

**Author:** ![YLM](https://avatars.discourse-cdn.com/v4/letter/y/59ef9b/32.png) [@YLM](https://discourse.nodered.org/u/YLM)\
**Post date:** [6 November 2019 17:36 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598/5 "2019-11-06T17:36:48Z")

</div>

thank you, reading your link helped me and I solved my problem !

---

<div class="post-metadata">

**Author:** ![YLM](https://avatars.discourse-cdn.com/v4/letter/y/59ef9b/32.png) [@YLM](https://discourse.nodered.org/u/YLM)\
**Post date:** [6 November 2019 17:37 UTC](https://discourse.nodered.org/t/error-while-sending-data-to-influxdb/17598/6 "2019-11-06T17:37:22Z")

</div>

thank you
