Version 16 (modified by 16 years ago) ( diff ) | ,
---|
Blueprint for Synchronisation
We need to be able to support synchronising data between instances:
All tables have UUID fields: DeveloperGuidelinesDatabaseSynchronization
We can Export the tables - CSV is best-supported within Web2Py currently
"complete database backup/restore with db.export_to_csv_file(..),db.import_from_csv_file(...),
reimporting optionally fixes references without need for uuid"
- http://groups.google.com/group/web2py/browse_thread/thread/c08d1b05ddda672c
- http://groups.google.com/group/web2py/browse_thread/thread/be927ccf4d9745d2/637e45ccc2cf2583
- http://groups.google.com/group/web2py/browse_thread/thread/55d923a51eca2c90
This can be done using appadmin, but we have started work on a user-friendly way of dumping all relevant tables:
controllers/default.py
views/default/export_data.html
views/default/import_data.html
Need clear list of which tables to include:
- not lookup lists which are the same across sites
- e.g. OpenStreetMap/Google Layers (but WMS/SOS Layers Yes. Shapefiles Layers Yes if uploads copied across as well)
- not site-specific stuff such as system_config, gis_keys, etc
Create an index manually to make the search by uuid faster.
other related threads:
- http://groups.google.com/group/web2py/browse_thread/thread/af3f7ad5271a10c6/c5e96141c13a29ad
- http://groups.google.com/group/web2py/browse_thread/thread/7d639c98b5b8dcd2/c0fe17ccbdd12eb7
There is a simple 1-table example appliance which has the ability to do syncs via XML-RPC:
In Sahana2 the record ids are UUIDs built from each instance's 'base_uuid'
There is a sync_instance table:
CREATE TABLE sync_instance ( base_uuid VARCHAR(4) NOT NULL, -- Instance id owner VARCHAR(100), -- Instance owner's name contact TEXT, -- Contact details of the instance owner url VARCHAR(100) DEFAULT NULL, -- Server url if exists last_update TIMESTAMP NOT NULL, -- Last Time sync with the instance sync_count INT DEFAULT 0, -- Number of times synchronized PRIMARY KEY(base_uuid) );