InfluxDB - Copy data to new sensor

Hi,

I got some long term history from an entity (pf_status) in InfluxDB v1, which got replaced with a new entity (cap_status).

I’d like to copy all the data from the old sensor to the new one. I only care about the data in Influx, not in HA itself. I am not really familiar with databases so I need some help.

The following query shows all the data which i want to copy:
USE “homeassistant”.“autogen”; SELECT “state” FROM “state” WHERE (“entity_id”::tag = ‘pf_status’)

So I tried:
USE “homeassistant”.“autogen”; SELECT * INTO cap_status FROM pf_status

It does say “Succes!”, but the old (test) data is still there, and none of the data from pf_status is copied.

Same with the following queries:
USE “homeassistant”.“autogen”; SELECT “state” INTO cap_status FROM pf_status WHERE (“entity_id”::tag = ‘pf_status’)

USE “homeassistant”.“autogen”; SELECT “state” INTO cap_status FROM pf_status WHERE time > -1200d AND (“entity_id”::tag = ‘pf_status’)"

At this point I’m just guessing, I tried all sort of things but nothing seem to work. Yes I do have a backup :wink:

Can anybody help me, what am I missing here? Thanks :slight_smile:

Unfortunately, I am facing the exact same problem.
I also got a new humidity sensor and want to replace the old one, but I need to transfer the measurements that were stored via InfluxDB.

I followed a similar process as shown in the pictures:


However, it seems that these commands are not supported, or I might be doing something wrong.

What can I do? I don’t want to lose my measurements.

Im using Grafana:Current version: 10.4.1 and InfluxDB:Current version: 5.0.2