I’m running InfluxDB 1.8.10 on a RPi and feeding sensor data to it from Node Red. I have been collecting data for around 1 year. When I originally constructed the database, I used a tutorial that suggested each sensor data type should be stored in a measurement resulting in quite a few measurements for just a small handful of sensors. I have just finished revamping my NR flows such that the data is now saved with a measurement containing multiple fields and some with a tag defining an ID or location.
Before I go down a deep rabbit hole and learn there is no solution, I was hoping to learn from the experts if there is a path for running a query to copy the data from the old measurements into the new ones?
old:
rtl_433/Acurite-5n1/A/battery_ok
rtl_433/Acurite-5n1/A/humidity
rtl_433/Acurite-5n1/A/rain_in
rtl_433/Acurite-5n1/A/rain_increment_in
rtl_433/Acurite-5n1/A/rain_increment_in_test
rtl_433/Acurite-5n1/A/temperature_F
rtl_433/Acurite-5n1/A/wind_dir_deg
rtl_433/Acurite-5n1/A/wind_mph
rtl_433/Blueline_PowerCost_Monitor/Cost
rtl_433/Blueline_PowerCost_Monitor/battery_ok
rtl_433/Blueline_PowerCost_Monitor/gap
rtl_433/Blueline_PowerCost_Monitor/impulses
rtl_433/Blueline_PowerCost_Monitor/impulses_increment
rtl_433/Blueline_PowerCost_Monitor/kW
rtl_433/Blueline_PowerCost_Monitor/kWh
rtl_433/Blueline_PowerCost_Monitor/kWh_increment
rtl_433/Blueline_PowerCost_Monitor/temperature_F
new
Acurite-5n1
Acurite-Tower
Blueline-PowerCost
The new sensors have the same fields as the original (plus a few more) but are grouped into the sensor rather than split as can be seen.
> select * from "Acurite-5n1" limit 10
name: Acurite-5n1
time battery_ok humidity id moisture rain_in rain_increment_in temperature_F wind_dir_deg wind_mph
---- ---------- -------- -- -------- ------- ----------------- ------------- ------------ --------
2022-04-07T20:55:07.272667488Z 0 29 2825 83.7 4.736339775709854
2022-04-07T20:55:25.640486573Z 0 2825 96.35 0 135 4.736339775709854
2022-04-07T20:55:43.432422666Z 0 30 2825 83.3 4.736339775709854
2022-04-07T20:56:01.828863057Z 0 2825 96.35 0 67.5 4.736339775709854
2022-04-07T20:56:19.635236878Z 0 30 2825 83.1 1.650113338105464
2022-04-07T20:56:37.99026959Z 0 2825 96.35 0 112.5 3.193226556907659
> select * from "Blueline-PowerCost" limit 10
name: Blueline-PowerCost
time Cost Rate battery_ok gap id impulses impulses_increment kW kWh kWh_increment temperature_F
---- ---- ---- ---------- --- -- -------- ------------------ -- --- ------------- -------------
2022-04-08T16:42:03.522951172Z 65533 10752 1.3184197274655516
2022-04-08T16:42:34.974036277Z 1 10752 48.7688
2022-04-08T16:43:06.986781313Z 10752 58243 1397.832
2022-04-08T16:43:07.473713977Z 65533 10752 1.3184197274655516
2022-04-08T16:43:38.932063387Z 65533 10752 1.3184197274655516
2022-04-08T16:44:10.953883312Z 65521 10752 1.3186611925947407
2022-04-08T16:44:42.899141013Z 35889 10752 2.4074228872356436
2022-04-08T16:45:14.991075231Z 28233 10752 3.0602486452024227
2022-04-08T16:45:14.993503166Z 28233 10752 3.0602486452024227
2022-04-08T16:45:46.919445123Z 1 10752 48.7688
A nudge in the right direction and perhaps a search term or two would be sufficient for now.