Short answer: Yes … But now you are “complicating it”
…if the script “Create / Alter / Drop / Delete” are not in conflict with present DB configuration
- Make sure you use same DB_Name as current -in HA
- Same User-Name /Passwd
3 Make Backup, on both “sites”
( Above makes life easier)
If Anything in the script is set to , Create/ Alter / Drop anything that this is present in MarieDB … guess what
If you already created a DB in MarieDB( Calling it the same as your current DB(home-assistant_v2.db) in, and HA is using this now for “Energy”, you are on thin ice …
So in short it depends on what you named your DB( in MariaDB), which Tables are already in existing(in Maria DB), and whether the script is written to Drop existing, and Creating New
And a “Normal” procedure for such a “big” task is to “stop db”, before export, stop db “when import”
You can use either of above( or in script) Queries on a running DB, but in import … But
As mention i’ve never perform such a task on a mariaDB, thou back in time on Oracle … and yes obviously, you will “loose” data ( from point in time-to point in time) , unless you perform a “Running Replication, and switch over” Which i doubt can be done in this scenario
PS: The solution (transfer old data), can be done, from a mariadb>mariadb with " insert into table ", … which i don’t see, and not are normal when you perform a migration like in the other “Topic”
Last but not least: As Toml mentioned, your longterm statistic will be your next “consern”
I would have/will eventually: Create MariaDB, on a “Mounted” mSate ( Have 2st 128GB in my laptop, only dedicated half/60GB to VM(Ha) partition on 1, so i was thinking( have partitioned the other, in 2 partitioned of 60 gb as well ) using 1 for files, 1 for comming DB ) … Creating 2 external MarieDB( and not starting using them before i plan to do a migration, if something goes wrong i immediate have the other available, to “try again” ), then do the migration, switch over, i dont mind loosing a days/data if it comes to that, the other DB i will use for other “purposes”, but also as a “Slave” replicating some “longterm” data( defined by me )
Edit: Actually the last proposed solution in above url, do use the running “partial insert” , i would go for that … what could go wrong ?