I've been looking for a solution to backup my db directly inside weewx 
without calling external cronjobs. The backup will be done on a SQL 
database running on another server.
For this reason I don't want to make a physical copy of the DB but instead 
copy only the rows that are not on the remote machine but on the local one 
using the epoch time as key: this will decrease the amount of time spent 
reading, passing and writing the data.

As far as I understand the SQLBackup and RSYNC skin work differently, so my 
idea was to write a Python script that is called directly after a record 
has been written by weewx into the DB and does that:

   1. get maximum epoch time on local copy of the db
   2. compare with maximum epoch time on remote copy of the db
   3. get rows in local db that have epoch time > epoch time on remote
   4. append rows to the remote copy of the db

(this of course assumes that both dbs are ordered by epoch time, which 
should be the case)
I will use Pandas to read the data from SQL. Every time that this Python 
script is called the local db will be loaded into memory (only the rows 
that need to be appended actually) so it will not be modified by newer 
appends done by weewx and will be left free for weewx to work on it. 

Is this a good strategy or does it have some pitfalls? I should be able to 
implement it fairly easy (I already did something similar in the past). 
Only need to understand how to package it as a weewx plugin. 

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/ea0624de-4233-4fd1-8b68-35f52d354c28n%40googlegroups.com.

Reply via email to