Specify a bucket in a Node-RED InfluxDB query node

Hi there

If I use an InfluxDBout node, there's the option to specify a bucket. That way I can send measurements to InfluxDB under a given bucket.

But now I want to write a query and pass this to an InfluxDBin node (which has input and output).

The query I have is like this:

SELECT * FROM "meters"
WHERE "meter"='lg_gas'
AND "reading"=123
AND time>=1734878286040
AND time<=1734878287040
LIMIT 1

But the InfluxDBin node only allows me to set the server, I can't see anywhere to set the bucket.

Would I specify that in the query itself? Or where exactly?

The InfluxDB documentation has your answer - but I think that Buckets are an InfluxDB v2 thing and I believe you need to be using Flux and not v1.8 InfluxQL:

from(bucket:"example-bucket")

Personally I am sticking with influxdb 1.8 until v3 is released. V2 with Flux was a dead end I think.

4 Likes

InfluxDB introducing Flux appears to have been a big mistake, like you @Colin I am staying with 1.8.

3 Likes

I sticked with V1 as well for the same reason.

FYI: there has been a recent update to the V1 branch from 1.8 to 1.11

2 Likes

Hi @hazymat

Are you using InfluxDB v1 OSS or InfluxDB v3 Cloud?

I believe you must map each database/bucket to its own DBRP. Scroll down towards the middle/end of this article for some potentially helpful info for using Node-RED with InfluxDB v3.

I have been with influxDB since it's release a never moved form 1.x for same reasons. Flux just flummoxed me.

However, I've just started out on QuestDB a timeseries DB. It's SQL based and supports the Influx line protocol which means it's supports schemaless which a must for me.

I used the InfluxDB node to connect to QuestDB to write and it just worked! QuestDB also supports PostgreSQL wire protocol so it's an option but have yet to try this out. It has neat web console which includes charting.

There is a native Grafana data source plugin and my Influx SQL queries only need two small changes to work on QuestDB. One drawback with OS version of QuestDB there is no TLS support so the best I can do is bind the service localhost.

My setup is Node-Red/QuestDB/Grafana on a RPI 3.

1 Like

Does it support Continuous Queries? I use those for automatically downscaling and/or deleting older data.

Alas not, though you can down sample with Sample By. There seems to be a new feature for tracking data change that might form the bases of a continuous query.
https://questdb.com/blog/tracking-data-changes-in-questdb/

I think I will stick with Influxdb 1 at the moment, and look at 3 when it arrives. v1 does everything I need.

3 Likes

Thanks - unfortunately I'm on Influx 2.6.1. Reading the comments here, I'd actually like to downgrade back to v1 as I found it much easier to wrap my head around. (Time series databases with their sharding, roll-ups, and time window functions is enough to confuse me let alone adding Flux QL on top of those concepts!)