1
I’ve setup a home automation system which logs data into influxdb. I’ve two measuraments taken from two variables concerning the same sensor. I would like to remove the old table and migrate old data from the old table to the new. Old table ‘entity_id=node21_child04’, new one ‘entity_id=node21samsung_21_4’. I’ve following data entries in an influxdb database:
> show series;
key
---
C,domain=sensor,entity_id=node21_child04
°C,domain=sensor,entity_id=node21samsung_21_4
Looking on the content, extracting some data, I get those results: Old table:
> SELECT * FROM "autogen"."C" WHERE ("entity_id" = 'node21_child04') AND time >= now() - 1d;
name: C
time domain entity_id friendly_name_str icon_str value
---- ------ --------- ----------------- -------- -----
1547806798546962944 sensor node21_child04 Esterno Nord - Temperatura mdi:temperature-celsius 7.2
1547806918435410944 sensor node21_child04 Esterno Nord - Temperatura mdi:temperature-celsius 7.4
1547807278994774016 sensor node21_child04 Esterno Nord - Temperatura mdi:temperature-celsius 7.5
1547807398204632064 sensor node21_child04 Esterno Nord - Temperatura mdi:temperature-celsius 7.4
1547807518145522176 sensor node21_child04 Esterno Nord - Temperatura mdi:temperature-celsius 7.5```
New table:
> SELECT * FROM "autogen"."°C" WHERE ("entity_id" = 'node21samsung_21_4') AND time >= now() - 10m;
name: °C
time V_TEMP battery_level child_id description description_str device_str domain entity_id friendly_name friendly_name_str heartbeat icon_str node_id value
---- ------ ------------- -------- ----------- --------------- ---------- ------ --------- ------------- ----------------- --------- -------- ------- -----
1547484922088189952 9.3 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9.3
1547485042146836992 9.4 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9.4
1547485162424854016 9 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9
1547485282887762176 8.7 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 8.7
I would like to migrate the values from the old table to the new one. So then I can stop collecting data to the old table and can delete it. Data can be overwritten without issues. How to do that?
Thanks, Simon