I have a Raspberry Pi collecting data from sensors attached to it. I would like to have this data - collected every minute - accessible from an online DB (Amazon RDS | MySQL).
Currently, a python script running on the Pi pushes this data to an Amazon RDS instance every 50 seconds (~per minute). However, I have no records when internet is down. I will appreciate any suggestions on how to fix this.
Here are my thoughts so far:

store data on a local MySQL DB, run a separate script that checks for differences between the online and local DB and updates the online one where needed. This will run every minute and write only one record to the online DB every minute if all is well.
Utilize some sort of feature within MySQL itself - a replication job?
I went with my first thought:

store the sensor data on a local DB (SQLite3 for its small footprint). Records are created every half minute.
a separate script - run regularly via cron - compares the last timestamp entry in the cloud DB with the local one and updates the cloud DB.

Even though the comparison would ideally mean a doubling of DB transactions (a read + a write), if the last timestamp recorded on the online DB is stored locally for reference the remote read becomes unnecessary, thus being more efficient.
Syncing locally collected regular data to online DB over unreliable internet connection