How to write code that syncs one table to another
- Source must have a timestamp column
- Target must remember the last timestamp processed.
- Source queries target for the last processed timestamp
- Source checks whether target
- is still importing previous data
- or has data that it hasn’t processed yet (import could have been killed halfway)
- If target is available to import data, source uploads data and triggers processing
- As data is imported, target saves the last processed timestamp
- Errors, exceptions are accumulated and reported
It is also handy to have a script that monitors the status of the batch process.
- is processing
- last timestamp processed
- number of rows left
About this entry
You’re currently reading “ How to write code that syncs one table to another ,” an entry on Chui's Counterpoint
- Published:
- 8.31.12 / 2pm
- Category:
- Engineering notes
Comments are closed
Comments are currently closed on this entry.