Python script to migrate ioBroker MySQL (SQL History Adapter) data to influxDB (Logging data with influxDB)
Based on a script from UlliJ from the ioBroker Forum
I have used the script to migrate 22 million records from a MySQL DB running on a Rasperry Pi to an influxDB on a Synology.
- Run
pip install -r requirements.txt
to install all requirements - The script processes the measuring points from
ts_number
,ts_bool
andts_string
- The data is retrieved in a batch of 100,000 data sets per measuring point and sent to influxDB in batches of 1,000 and the progress is displayed.
- Rename
database.json.example
todatabase.json
and adjust the values forhost
,port
,user
,passwd
anddb
to your enviroment. When your InfluxDB has no user/password change the values to an empty string. - To migrate all datapoints run
migrate.py ALL
, to migrate one datapoint runmigrate.py "hm-rega.0.NEQ1332020"
ormigrate.py "hm-rega.0.%"
to migrate allhm-rega.0
datapoints