IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35031


Ignore:
Timestamp:
Jan 23, 2013, 3:03:08 PM (13 years ago)
Author:
eugene
Message:

drop dvodetection table before each dvopsps bulk insert operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py

    r35026 r35031  
    3333
    3434    '''
    35     def __init__(self, logger, config, scratchDbName="ipptopsps_scratch"):
     35    def __init__(self, logger, config, scratchDbName="ipptopsps_test_scratch"):
    3636
    3737        # set up logging
     
    570570    def nativeIngestDetections(self, raCenter, decCenter, boxSize):
    571571
    572         # self.scratchDb.resetAllDvoTables()
     572        # XXX put the chunk below in a separate method
     573       
     574        # drop detections table
     575        self.logger.infoPair("Dropping table", self.scratchDb.dvoDetectionTable)
     576        self.scratchDb.dropTable(self.scratchDb.dvoDetectionTable)
     577       
     578        # create detections table
     579        self.logger.infoPair("Creating table", self.scratchDb.dvoDetectionTable)
     580        sql = "CREATE TABLE " + self.scratchDb.dvoDetectionTable + " LIKE dvoDetection"
     581        try: self.scratchDb.execute(sql)
     582        except:
     583            self.logger.errorPair("Unable to create table", self.scratchDb.dvoDetectionTable)
     584            return False
     585        self.scratchDb.changeEngineToInnoDB(self.scratchDb.dvoDetectionTable)
     586       
     587        # add fileID column
     588        sql = "ALTER TABLE " + self.scratchDb.dvoDetectionTable + " ADD fileID INT NOT NULL"
     589        try: self.scratchDb.execute(sql)
     590        except:
     591            self.logger.errorPair("Unable to add fileID column to ", self.scratchDb.dvoDetectionTable)
     592            return False
     593
     594        # add an index to the fileID column
     595        self.scratchDb.createIndex(self.scratchDb.dvoDetectionTable, "fileID")
    573596
    574597        # make sure we have an up-to-date Images table
Note: See TracChangeset for help on using the changeset viewer.