Aggregate sqlite data to cloud sql db

My home assistant runs on a rPi. It collects a lot of sensors data and records it. In order to mine it, I am interested to aggregate this data in an SQL server (either local or in the cloud) rather than the local MicroSD card.
One way to do this is to copy the recorded from the local SQLite db over to a SQL database server. From the HA documentation, I understand that the recorded data gets purged once a week (this is configurable). So as long as the copy is done before the purge all data is nicely accumulated on the SQL server. I believe the data copy could be implemented inside of HA (maybe where the purge is managed) or as a demon just accessing the HA SQLite db.

I wonder if there is already a solution for this (that I did not find) or anyone in this community that has done something similar.

I use a separate MySQL server with hassio. It runs on the host (not a pi) and I retain the data for 60 days.
Because I also have other MySQL dependent applications running.

Then for backup and to keep historical data I use

It all works flawlessly - touches wood!