I’m in the process of migrating all my data to influx 2 and i have run in to an issue.
Before i used QC to create min, max and mean daily data for all raw values.
this is the old QC:
CREATE CONTINUOUS QUERY daily_mean ON home
BEGIN SELECT mean(*) INTO home.longterm.hc_daily_mean
FROM home.raw.hc GROUP BY time(1d) END
i have converted it to:
option task = {
name: "daily_mean",
every: 1d,
}
from(bucket: "raun3")
|> range(start: -task.every)
|> filter(fn: (r) => r._measurement == "hc")
|> aggregateWindow(every: 1d, fn: mean)
|> set(key: "_measurement", value: "hc_daily_mean")
|> to(
org: "svein",
bucket: "raun3.longterm",
)
this works fine but the field names are not the same as they used to be.
in influx 1.8.x the names was prepended with the function name. so
“sensor_some_name”
was renamed to
“mean_sensor_some_name”
with the new flux task the field names are kept unchanged.
this causes a mismatch with all the old field names that i have from influx 1.8.x
so now i have
“mean_sensor_some_name” for all data before the update,
and
“sensor_some_name” for all the new data.
how can i prepend “mean_” for all the new data so it matches the old?