wiki:DeveloperGuidelines/DatabaseSynchronization

Database Synchronization

Requirements

All tables which should be replicated need to include the 2 reusable fields, timestamp & uuidstamp:

table = db.define_table(tablename, timestamp, uuidstamp, ... )

If using the S3 REST Controller, then this is all that is required.

Manual Form processing

If doing manual form processing, then you need to add support within the add_record controller function:

if form.accepts(request.vars, session, keepvalues=True):
    # Update Database
    id = db.table.insert(uuid=uuid.uuid4())

Master Copy Index

The mci field is included as part of the uuidstamp reusable field.

  • mci=0 => Original source of Data
  • mci=1 => We received this from the original source
  • mci=2 => We received this from someone who got it from the original source
  • etc
  • mci=-1 => Data which shouldn't be synced (typically Reference Data)

Sync Resolvers

Special rules can be developed which extend the default S3ImportJob class to deal with resource-specific issues.

Future

This functionality needs to be developed further to provide a custom UI to do the Import/Export (currently can just use appadmin's default one):


DeveloperGuidelines

Last modified 11 years ago Last modified on 07/04/13 10:32:06
Note: See TracWiki for help on using the wiki.