Changeset 3869
- Timestamp:
- 08/05/08 17:18:16 (13 years ago)
- Location:
- TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/PostgresDAO.py
r3862 r3869 146 146 ''' 147 147 logging.info("Deleting existing spatiotemporal data for record") 148 sqlCmd = "DELETE FROM SPATIAL_TEMPORAL_DATA WHERE original_ record_id = " + \148 sqlCmd = "DELETE FROM SPATIAL_TEMPORAL_DATA WHERE original_document_id = " + \ 149 149 str(self._record.db_id) + ";" 150 150 … … 237 237 self._record.db_id = id[0][0] 238 238 logging.info("Original document inserted in Postgres DB") 239 240 241 def deleteOriginalRecord(self): 242 ''' 243 Delete the original metadata doc from the postgres DB 244 ''' 245 logging.info("Deleting original document from Postgres DB") 246 sqlCmd = "SELECT delete_document('" + str(self._record.db_id) + "');" 247 248 db_funcs.runSQLCommand(self._connection, sqlCmd) 249 logging.info("Original document deleted from Postgres DB") 239 250 240 251 … … 266 277 for docType, doc in self._record.getAllDocs(): 267 278 sqlCmd = "INSERT INTO TRANSFORMED_DOCUMENT (transformed_document_id, " \ 268 "original_ record_id, transformed_format, " \279 "original_document_id, transformed_format, " \ 269 280 "transformed_document, create_date, scn) VALUES (" \ 270 281 "DEFAULT, '" + str(self._record.db_id) + "', '" + \ … … 287 298 for docType, doc in self._record.getAllDocs(): 288 299 sqlCmd = "UPDATE TRANSFORMED_DOCUMENT SET transformed_document = '" + doc + \ 289 "', update_date = current_timestamp WHERE original_ record_id = " + \300 "', update_date = current_timestamp WHERE original_document_id = " + \ 290 301 str(self._record.db_id) + " AND transformed_format = '" + docType + "';" 291 302 -
TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/PostgresRecord.py
r3862 r3869 19 19 from FileUtilities import FileUtilities 20 20 from SpatioTemporalData import SpatioTemporalData 21 import keywordAdder 21 22 22 23 class PostgresRecord: … … 184 185 %self.docType) 185 186 187 # now run the appropriate transform and set the attribute 188 setattr(self, "_molesFormat", self.doTransform(xqName)) 189 186 190 # add keywords, if required 187 191 if self._datacentre_groups != "": 188 addKeywords() 189 190 # now run the appropriate transform and set the attribute 191 setattr(self, "_molesFormat", self.doTransform(xqName)) 192 self.addKeywords() 192 193 193 194 # escape any apostrophes … … 203 204 ''' 204 205 logging.info("Adding datacentre keywords to moles file") 206 205 207 # NB, use temporary directories to do the keyword additions 206 tmpDir = os.getcwd() + "/ "207 tmpKeywordsDir = os.getcwd() + "/ke wordsAdded/"208 tmpDir = os.getcwd() + "/tmp/" 209 tmpKeywordsDir = os.getcwd() + "/keywordsAdded/" 208 210 self._fileUtils.setUpDir(tmpDir) 209 211 self._fileUtils.setUpDir(tmpKeywordsDir) 210 212 tmpFile = 'tmpFile.xml' 211 self._fileUtils.createFile(tmpDir + "/" + tmpFile, self._molesFormat) 212 213 keywordAdder.main(tmpDir, tmpKeywordsDir, self.datacentre_groups) 214 213 self._fileUtils.createFile(tmpDir + tmpFile, self._molesFormat) 214 215 keywordAdder.main(tmpDir, tmpKeywordsDir, self._datacentre_groups) 216 217 sys.exit() 215 218 # Now load in the converted file 216 219 f=open(tmpKeywordsDir + "/" + tmpFile, 'r') -
TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/run_all_ingest.py
r3862 r3869 40 40 oai_document_ingester(datacentre) 41 41 except: 42 logging.error("Exception thrown - detail: ") 43 logging.error(sys.exc_info()) 44 logging.info("Continue processing next datacentre config file...") 42 45 error_counter +=1 43 46
Note: See TracChangeset
for help on using the changeset viewer.