[Tutor] ways to sync databases with Python and SQLite?

Alan Gauld alan.gauld at btinternet.com
Wed Sep 10 01:51:02 CEST 2008


"Che M" <pine508 at hotmail.com> wrote in message

> I'd like to get ideas about how I could extend the application so 
> that the
> databases on each computer could be kept "synchronized"

How do you intend to get the two computers to talk?
Basically for any kind of synch both com,puters need to
be able to compare notes. So the first question is what
do we mean by synching here. Will it be over a network
(the internet?)? Is it via a memory stick file transfer?

> (I realize a good way to do all of this is entirely as
> a web service, but that is beyond my abilities,

Its one possibility but I'm not sure I'd say it was "the best" way.

> So, if anyone has ideas on ways to do this with Python
> and Sqlite that are:
> - fairly simple (I'm not a real programmer)

If you are using Python and SQLite then I beg to differ :-)

The key here is to keep a rolling log of what has changed.
It can be a simple text file - which can be transferred between
PCs and used to synch or it could be a database table.
You then read both synch logs and eliminate conflicts then
apply the merged set of changes. (A lot easier said than done!)

You might want to try a dummy application with a single table
and limited update opportunities to get the feel for this before
trying it on the real data! And be sure to take copious backups
while testing!

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list