IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31322


Ignore:
Timestamp:
Apr 19, 2011, 10:57:22 AM (15 years ago)
Author:
rhenders
Message:

added Db table row count method; changed dvo table - now have dvoDetection and dvoMeta; method to grab photcode from dvo meta table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/batch.py

    r31305 r31322  
    6363
    6464            # get survey ID from init table
    65             sql = "SELECT surveyID from Survey WHERE name = '" + self.survey + "'"
     65            sql = "SELECT surveyID FROM Survey WHERE name = '" + self.survey + "'"
    6666            try:
    6767                rs = self.localStmt.executeQuery(sql) 
     
    109109
    110110        # create DVO table
    111         self.createDvoTable()
     111        self.createDvoTables()
     112
     113
     114    '''
     115    Gets photcode (aka photoCalID from dvo table)
     116    '''
     117    def getPhotoCalID(self):
     118
     119        photcode = -1
     120
     121        sql = "SELECT photcode FROM dvoMeta"
     122        try:
     123            rs = self.localStmt.executeQuery(sql) 
     124            rs.first()
     125            photcode = rs.getInt(1)
     126        except:
     127            self.logger.exception("Unable to get photcode from dvo table")
     128
     129
     130        return photcode
    112131
    113132    '''
     
    367386        try:
    368387            self.localStmt.execute(sql)
    369         except:
    370             self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
     388        except: pass
     389            #self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'")
    371390
    372391
     
    399418          table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
    400419          table = stilts.tpipe(table, cmd='replaceval Infinity null *')
    401           #params = table.parameters()
    402           #print params
    403420
    404421          try:
     
    533550    def updateDvoIDs(self, table):
    534551
    535         self.logger.info("Updating table '" + table + "' with DVO IDs...")
    536         sql = "UPDATE " + table + " AS a, dvo AS b SET \
    537                a.ippObjID = b.ippObjID, \
    538                a.objID = b.objID \
    539                WHERE a.ippDetectID = b.ippDetectID"
    540         self.localStmt.execute(sql)
    541         self.logger.info("...done")
    542 
     552        self.logger.info("Not implemented in base-class")
    543553
    544554    '''
    545555    Creates a table for for ID matching
    546556    '''
    547     def createDvoTable(self):
    548 
    549         self.logger.info("Creating DVO table for ID matching")
    550         sql = "DROP TABLE dvo"
    551         self.localStmt.execute(sql)
    552         sql = "CREATE TABLE dvo (ippDetectID BIGINT PRIMARY KEY, detectID BIGINT, ippObjID BIGINT, objID BIGINT)"
    553         self.localStmt.execute(sql)
    554 
     557    def createDvoTables(self):
     558
     559        self.logger.info("Creating DVO meta and detection tables")
     560        sql = "DROP TABLE dvoMeta"
     561        try: self.localStmt.execute(sql)
     562        except: pass
     563       
     564        sql = "DROP TABLE dvoDetection"
     565        try: self.localStmt.execute(sql)
     566        except: pass
     567
     568        sql = "CREATE TABLE dvoMeta ( \
     569               flags INT, \
     570               photcode INT \
     571               )"
     572
     573        try: self.localStmt.execute(sql)
     574        except:
     575            self.logger.error("Unable to create DVO meta-data database tablei")
     576
     577        sql = "CREATE TABLE dvoDetection ( \
     578               ippDetectID BIGINT PRIMARY KEY, \
     579               detectID BIGINT, \
     580               ippObjID BIGINT, \
     581               objID BIGINT \
     582               )"
     583
     584        try: self.localStmt.execute(sql)
     585        except:
     586            self.logger.error("Unable to create DVO detection database table")
    555587
    556588    '''
     
    582614        self.logger.info("...done")
    583615
     616        if self.getRowCount("dvoDetection") < 1:
     617            self.logger.error("No DVO IDs found")
     618            return False
     619           
     620        return True
     621
Note: See TracChangeset for help on using the changeset viewer.