Setup:
I’m using Chronograf 1.10.0 (on Docker) on influxDB 1.8 (on Docker) to store data of my smarthome installation (openHAB, also on Docker).
Task:
Due to a logic change of one of my sensors, my energy measurements are now stored as “kWh per day” (vs. previously “average kW per 24 hours”). To have consistent data, I’d like to replace all values of a certain table with “old value * 24”. What I like to do is very similar to what’s reported reported (and solved) here. However, I was not able to apply the solution presented there to my problem. I’ve tried different approaches, each leading to roadblocks.
Option / Problem 1: Apply the example above in Chronograf.
If I apply the code to my setting…
from(bucket: "openhab_db/autogen")
|> range(start: -2y, stop: now())
|> filter(fn: (r) => r._measurement == "RainPastHour")
|> map(fn: (r) => ({ r with _value: r._value * 24 }))
|> to(bucket: "openhab_db/autogen")
… I’m getting the error error calling function "to": function "to" is not implemented
. Here I read that Flux in InfluxDB 1.x is read-only, so I am not able to write data back to InfluxDB. Is this true? If yes, what’s the alternative? Using influxQL instead?
Option / Problem 2: Use influxQL in Chronograf.
Assuming that Flux cannot write data, I tried switching to influxQL in Chronograf. If I run the following query…
UPDATE RainPastHour SET RainPastHour = RainPastHour * 24 where time > '2022-01-11 08:00:00' and time < '2022-12-11 12:00:00'
… I get the error error parsing query: found UPDATE, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET, KILL at line 1, char 1
, so obviously this won’t work as well.
Which brings me back to square 1: How do I change data in influxDB 1.8?
Thanks a lot in advance for anyone who can help me.