Migrate data from InfluxDB v2 to TimescaleDB

I have been tinkering with my persistence databases. I ran InfluxDB v1 for almost 3 years now and made a mistake by upgrading to InfluxDB v2 a couple of months ago. Couldn’t get used to the flux language. I decided to install Progresql and TimescaleDB. I couldn’t find anything for migrating my data though, so I wrote a rudimentary python script to export the data from Influx and import it into the correct (hyper)tables in TimescaleDB/Progresql.

I’ve uploaded my scripts to github (JarnoBoks/oh-influx2timescale: openHAB persistance data influxDB v2 to TImescalDB migration scripts) for anyone that wants to walk the same path.

I’m no official developer, so the script is quite rudimentary. But I wrote an extensive Readme file.

Please, please, please: before running this script on your production environment, execute a dry-run on an empty database and ensure you have a working backup of the source and target databases. As always there is a risk of data loss (the script will remove any existing data in tables in the target database for items that are migrated).

I cannot (and will not) guarantee this script will work for your situation. But it could be a nice starting point for anyone facing the same migration issue as I did.

1 Like