Updating a local sqlite db that is used for local metadata & caching from an service?

Posted by Pharaun on Stack Overflow See other posts from Stack Overflow or by Pharaun
Published on 2010-04-26T14:51:35Z Indexed on 2010/04/26 14:53 UTC
Read the original article Hit count: 291

I've searched through the site and haven't found a question/answer that quite answer my question, the closest one I found was: Syncing objects between two disparate systems best approach.

Anyway to begun, because there is no RSS feeds available, I'm screen scrapping a webpage, hence it does a fetch then it goes through the webpage to scrap out all of the information that I'm interested in and dumps that information into a sqlite database so that I can query the information at my leisure without doing repeat fetching from the website.

However I'm also storing various metadata on the data itself that is stored in the sqlite db, such as: have I looked at the data, is the data new/old, bookmark to a chunk of data (Think of it as a collection of unrelated data, and the bookmark is just a pointer to where I am in processing/reading of the said data).

So right now my current problem is trying to figure out how to update the local sqlite database with new data and/or changed data from the website in a manner that is effective and straightforward.

Here's my current idea:

  1. Download the page itself
  2. Create a temporary table for the parsed data to go into
  3. Do a comparison between the official and the temporary table and copy updates and/or new information to the official table

This process seems kind of complicated because I would have to figure out how to determine if the data in the temporary table is new, updated, or unchanged. So I am wondering if there isn't a better approach or if anyone has any suggestion on how to architecture/structure such system?

© Stack Overflow or respective owner

Related posts about sqlite

Related posts about datasynchronization