# Using InfluxDB 1.8 with node red

**URL:** <https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654>\
**Category:** General\
**Created:** [24 December 2021 12:07 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654 "2021-12-24T12:07:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saxenaramesh](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@saxenaramesh](https://discourse.nodered.org/u/saxenaramesh)\
**Post date:** [24 December 2021 12:07 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654/1 "2021-12-24T12:07:23Z")

</div>

I am very new to Node-red. I am using node-red version v1.3.5 and Influxdb 1.8.10  
I am trying to get data into node red from Influx. I am able to run the following query in node-red function node and it works well:  
msg.query='select \* from em001'  
my measurement name in influx is em001.  
now if I want to add WHERE clause, it gets bit complicated.  
I tried the following command at influx CLI and it works perfectly fine:  
\<select \* from em001 where type='para1'\>  
it shows me all the data with tag type of para1.  
I added this query to node red function node but it does not work:  
msg.query='select \* from em001 where type='paral1''  
its not possible to use single quotes at 'para1' in the function node. I can use double quotes but these are not accepted by Influxdb and I always get error / empty query.

My flow is as below:

[  
{  
"id": "614a6e42.9a771",  
"type": "influxdb in",  
"z": "5e1050a9.7d05e",  
"influxdb": "f0eb6285.91715",  
"name": "",  
"query": "",  
"rawOutput": false,  
"precision": "",  
"retentionPolicy": "",  
"org": "organisation",  
"x": 620,  
"y": 160,  
"wires": [  
[  
"24212ff0.b802b"  
]  
]  
},  
{  
"id": "1cd9712c.5bba8f",  
"type": "inject",  
"z": "5e1050a9.7d05e",  
"name": "",  
"props": [  
{  
"p": "payload"  
},  
{  
"p": "topic",  
"vt": "str"  
}  
],  
"repeat": "",  
"crontab": "",  
"once": false,  
"onceDelay": 0.1,  
"topic": "",  
"payload": "",  
"payloadType": "date",  
"x": 210,  
"y": 180,  
"wires": [  
[  
"2c72f17c.662ffe"  
]  
]  
},  
{  
"id": "2c72f17c.662ffe",  
"type": "function",  
"z": "5e1050a9.7d05e",  
"name": "",  
"func": "msg.query = 'select \* from em001 where type=para1';\nreturn msg;\n",  
"outputs": 1,  
"noerr": 0,  
"initialize": "",  
"finalize": "",  
"libs": ,  
"x": 380,  
"y": 180,  
"wires": [  
[  
"614a6e42.9a771"  
]  
]  
},  
{  
"id": "24212ff0.b802b",  
"type": "debug",  
"z": "5e1050a9.7d05e",  
"name": "",  
"active": true,  
"tosidebar": true,  
"console": false,  
"tostatus": false,  
"complete": "false",  
"statusVal": "",  
"statusType": "auto",  
"x": 880,  
"y": 180,  
"wires":   
},  
{  
"id": "f0eb6285.91715",  
"type": "influxdb",  
"hostname": "127.0.0.1",  
"port": "8086",  
"protocol": "http",  
"database": "EMS",  
"name": "",  
"usetls": false,  
"tls": "",  
"influxdbVersion": "1.x",  
"url": "[http://localhost:8086](http://localhost:8086)",  
"rejectUnauthorized": true  
}  
]

Kindly help me to resolve this issue. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 December 2021 12:20 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654/2 "2021-12-24T12:20:01Z")

</div>

Hi @saxenaramesh, I hope you are having fun with Node-Red.

The flow that you posted cannot be imported because you didn't use the "preformatted text" button.  
Can you post it again:  
Export the flow in Node-Red  
Click the preformatted text button `</>`  
Paste your flow over the highlighted text.

If you are new to Node-Red, why are you using an old version? The current version is 2.1.4.

---

<div class="post-metadata">

**Author:** ![saxenaramesh](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@saxenaramesh](https://discourse.nodered.org/u/saxenaramesh)\
**Post date:** [24 December 2021 12:31 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654/3 "2021-12-24T12:31:16Z")

</div>

Hi jbudd,

thanks for quick reply. my flow is as below (now with preformatted option)

```auto
[
    {
        "id": "614a6e42.9a771",
        "type": "influxdb in",
        "z": "5e1050a9.7d05e",
        "influxdb": "f0eb6285.91715",
        "name": "",
        "query": "",
        "rawOutput": false,
        "precision": "",
        "retentionPolicy": "",
        "org": "organisation",
        "x": 620,
        "y": 160,
        "wires": [
            [
                "24212ff0.b802b"
            ]
        ]
    },
    {
        "id": "1cd9712c.5bba8f",
        "type": "inject",
        "z": "5e1050a9.7d05e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 210,
        "y": 180,
        "wires": [
            [
                "2c72f17c.662ffe"
            ]
        ]
    },
    {
        "id": "2c72f17c.662ffe",
        "type": "function",
        "z": "5e1050a9.7d05e",
        "name": "",
        "func": "msg.query = 'select * from em001 where type=para1';\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 180,
        "wires": [
            [
                "614a6e42.9a771"
            ]
        ]
    },
    {
        "id": "24212ff0.b802b",
        "type": "debug",
        "z": "5e1050a9.7d05e",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 180,
        "wires": []
    },
    {
        "id": "f0eb6285.91715",
        "type": "influxdb",
        "hostname": "127.0.0.1",
        "port": "8086",
        "protocol": "http",
        "database": "EMS",
        "name": "",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    }
]

```

I hope this is OK this time. I am new to node red and still use 1.3.x. Actually I started learning node red before release of version 2.x and then I did not feel the need to upgrade as I am finding 1.3.x good enough for my learning. I will surely try to upgrade as the time permits.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 December 2021 13:58 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654/4 "2021-12-24T13:58:33Z")

</div>

Does it work with this function node?

```auto
[
    {
        "id": "2c72f17c.662ffe",
        "type": "function",
        "z": "7ca1b48862231788",
        "name": "",
        "func": "msg.query = \"select * from em001 where type = 'para1' \";\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 310,
        "y": 360,
        "wires": [
            [
                "614a6e42.9a771"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![saxenaramesh](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@saxenaramesh](https://discourse.nodered.org/u/saxenaramesh)\
**Post date:** [24 December 2021 18:10 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654/5 "2021-12-24T18:10:59Z")

</div>

Yes, it works. Thanks a lot for your help. You really made my day.  
Now, I am wondering why I did not think that way 😉 😃

God bless you. Wishing you Merry Christmas and a very Happy New Year.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 January 2022 18:11 UTC](https://discourse.nodered.org/t/using-influxdb-1-8-with-node-red/55654/6 "2022-01-07T18:11:15Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
