I configured my recorder settings to use a postgresql database. Now I’m thinking to switch servers for my home assistant installation, but I’d like to go back to using sqlite locally.
Is there a way to convert my postgresql data back to sqlite to keep using my long-term stats?
It will be a complicated process. Others have done it and there are large threads with dozens of back-and-forth “tried this, didn’t work” messages. Your best bet is to likely start with a fresh database, but that doesn’t mean you have to lose your long term data.
You will be knee deep in lots of SQL statements and likely a lot of command line work to get it working.
This is why I set up InfluxDB as my long term statistics database (it runs beside your database, not as a replacement and is only for long term), then i can do whatever I want with my main database because the data I really care about, the long term stuff, is always in Influx. The only way this helps you is if you want to run Influx for a while before you make the switch.
Someone may chime in with a sure-fire way to change databases, but I’ve seen countless threads of people switching databases and it’s always a chore and usually has lots of failures.