django multi application, multi database, need to sync..

8 views
Skip to first unread message

otonk

unread,
Jan 16, 2008, 9:58:54 PM1/16/08
to Django users
hi, i am currently designing two or more django application, one
application act as the master application, contains all the data, the
other application has partial function of the master application. The
master database belongs to the master application, other database has
a partial data from the master database. The reason we have such
design is these application is separated geographically and the
connection may not be always available. The problem with this design
is how to move partial data from master db to other db, the sync
process is triggered by user. I need an way to sync the data. I know
this is doable but I am confused with the implementation. Any solution
is appreciated. Thank you.

Ivan Illarionov

unread,
Jan 17, 2008, 5:56:09 AM1/17/08
to Django users
Create the sync script using the Python DB API directly (no Django
ORM). And then trigger it either automatically with the cron job or
manually, by wrapping that script inside django view. You may want to
add `modified` DateTimeField to all your Django models and store the
last sync date/time somewhere. So the sync script should only SELECT
records from master database where 'modified' is greater than last
sync date and INSERT/UPDATE it into other database.

otonk

unread,
Jan 17, 2008, 10:18:12 PM1/17/08
to Django users
> Create the sync script using the Python DB API directly (no Django
> ORM). And then trigger it either automatically with the cron job or
> manually, by wrapping that script inside django view. You may want to
> add `modified` DateTimeField to all your Django models and store the
> last sync date/time somewhere. So the sync script should only SELECT
> records from master database where 'modified' is greater than last
> sync date and INSERT/UPDATE it into other database.

cool thanks Ivan..

Ivan Illarionov

unread,
Jan 18, 2008, 8:10:56 AM1/18/08
to Django users
And it's also important to not really delete records from database.
Use the 'delete' boolean field to mark unneeded records.
Reply all
Reply to author
Forward
0 new messages