How to do simple value manipulations of existing values in influxDB

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).

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.

Hello @RedwoodRed,
Unfortunately, that is true of 1.x you must upgrade to 2.x to take advantage of the to() function.
Unfortunately, you can’t perform updates with InfluxQL.

You can simply overwrite existing points assuming they have the same series (same combination of measurement, tag set, and field keys).
For example if your old data was written with:
mymeasurement, tagkey1=mytagkey1value fieldkey1=24 1672167317
If you then wrote:
mymeasurement, tagkey1=mytagkey1value fieldkey1=100 1672167317
The second point would replace the first and you would overwrite your data.

So you must either upgrade or rewrite values to InfluxDB.

Thanks a lot @Anaisdg, for your explanation. This confirms my assumptions.

Here‘s what I made out of it (documented it both for myself as well as for others from the openHAB community who might use influxDB as well / facing similar changes).

If you see something overly stupid in there, let me know.