Changeset 6851


Ignore:
Timestamp:
28/04/10 16:42:05 (9 years ago)
Author:
sdonegan
Message:

Updated to handled checking changes to xml - looks in transformed_doc now as db structure changed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery-Ingest/trunk/v4n_MEDIN/ingestAutomation-upgrade/OAIBatch/PostgresDAO.py

    r6685 r6851  
    5050        sql = "SELECT original_document_id FROM ORIGINAL_DOCUMENT where discovery_id = '" + \ 
    5151            self._record.discovery_id + "';" 
     52             
     53        logging.info("sql lookup cmd = " + sql) 
    5254        dbId = self.pgc.runSQLCommand(sql) 
    5355        if dbId: 
     
    298300        ''' 
    299301        logging.info("Checking the updated document actually contains changes") 
    300  
    301         sql = "SELECT harvest_count, scn FROM ORIGINAL_DOCUMENT where original_document_id = " + \ 
    302             str(self._record.db_id) + " AND original_document = '" + self._record.originalFormat + "';" 
    303         results = self.pgc.runSQLCommand(sql) 
    304  
     302         
     303        #sql = "SELECT harvest_count, scn FROM ORIGINAL_DOCUMENT where original_document_id = " + \ 
     304        #    str(self._record.db_id) + " AND original_document = '" + self._record.originalFormat + "';" 
     305         
     306        #get the harvest count and scn from the original_document table... 
     307        sql_orig = "SELECT harvest_count, scn FROM ORIGINAL_DOCUMENT where original_document_id = " + str(self._record.db_id) + ";" 
     308         
     309        results_orig = self.pgc.runSQLCommand(sql_orig) 
     310         
     311        #get the original_document from the transformed docs table         
     312        sql_transf = "SELECT transformed_document_id FROM transformed_document where original_document_id = " + str(self._record.db_id) +  \ 
     313                " AND transformed_document = '" + self._record.originalFormat + "';" 
     314                 
     315        results_transf = self.pgc.runSQLCommand(sql_transf)         
     316         
    305317        # NB, if the document is not identical, the sql command will not find anything 
    306         if not results: 
     318        if not results_transf: 
    307319            logging.info("Ingested document is different to that in the current DB") 
     320             
    308321            # get the current SCN 
    309322            sql = "SELECT scn FROM ORIGINAL_DOCUMENT where original_document_id = " + \ 
     
    313326            return True 
    314327             
    315         count = results[0][0] 
     328        count = results_orig[0][0] 
    316329 
    317330        # get current system change number 
    318         scn = results[0][1] 
     331        scn = results_orig[0][1] 
    319332        self._record.scn = scn 
    320333        logging.info("Ingested document is identical to document currently in DB - " + \ 
Note: See TracChangeset for help on using the changeset viewer.