IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 20, 2015, 1:19:35 PM (11 years ago)
Author:
heather
Message:

current state of ipptopsps / sas37 - ob/p2/st/df work

File:
1 edited

Legend:

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

    r37763 r37917  
    293293        self.generateRandomIDs()
    294294
     295        self.logger.infoPair("Adding 'row' columns to", "StackObjectThin")
     296        self.scratchDb.addRowCountColumn("StackObjectThin", "row")
     297        self.logger.infoPair("Adding unique psps ids to", "StackObjectThin")
    295298        self.generateStackDetectRowIDsAndPspsUniqueIDs()
     299        self.logger.infoPair("Dropping row column from", "StackObjectThin table")
     300        self.scratchDb.dropColumn("StackObjectThin", "row")
     301
    296302
    297303        # add indexes StackObjectThin
     
    372378                self.logger.errorPair('failed sql: ', sql)
    373379                raise
     380
     381
     382            # we do not yet set bestdetection, this is a placeholder until we do
     383            sql = "UPDATE StackObjectThin set bestDetection = 0"
     384            try:
     385                self.scratchDb.execute(sql)
     386            except:
     387                self.logger.errorPair('failed sql: ', sql)
     388                raise
     389
    374390
    375391        self.tablesToExport.append("StackObjectThin")
     
    756772
    757773        minRadius = 1
    758         maxRadius = 10
     774        maxRadius = 9
    759775        if tablename == 'StackApFlx':
    760776            minRadius = 3
     
    765781
    766782        sqlLine = sqlUtility("UPDATE " + tablename + " SET")
    767         for radius in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
     783        for radius in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    768784            if radius < minRadius: continue
    769785            if radius > maxRadius: continue
     
    950966
    951967    def generateStackDetectRowIDsAndPspsUniqueIDs(self):
    952         sql = "UPDATE StackObjectThin join (select @r:=@r+1 rownum, objID from \
    953         (select @r:=0) r, StackObjectThin t) as foo using (objID) set \
    954         stackDetectRowID = ((" + str(self.batchID) + " << 32 ) + rownum), \
    955         uniquePspsSTid = ((" +str(self.batchID)+ "*1000000000 ) + rownum)";
     968#        sql = "UPDATE StackObjectThin join (select @r:=@r+1 rownum, objID from \
     969#        (select @r:=0) r, StackObjectThin t) as foo using (objID) set \
     970#        stackDetectRowID = ((" + str(self.batchID) + " << 32 ) + rownum), \
     971#        uniquePspsSTid = ((" +str(self.batchID)+ "*1000000000 ) + rownum)";
     972        sql = "UPDATE StackObjectThin set uniquePspsSTid = (("+str(self.batchID)+"*1000000000 ) + row)"
     973
    956974        try: self.scratchDb.execute(sql)
    957975        except:
     
    10101028            self.scratchDb.addColumn(table, filter + "haveData", "tinyint")
    10111029
    1012         fields = "objID, ippObjID, randomStackObjID, primaryDetection, bestDetection, uniquePspsSTID, "
     1030        fields = "objID, ippObjID, randomStackObjID, primaryDetection, bestDetection, uniquePspsSTID, StackDetectRowID, "
    10131031
    10141032        for i in range(len(self.filters)):
     
    10161034            fields += filter + "ippDetectID, "
    10171035            fields += filter + "stackDetectID, "
     1036#            fields += filter + "StackDetectRowID, "
    10181037            fields += filter + "stackMetaID " # careful here: do not add comma to last entry
    10191038            if (i < len(self.filters) - 1):
    10201039                fields += ", "
    10211040
    1022         if (table == "StackObjectAttributes"):
    1023             fields += ", stackDetectRowID "
     1041        #if (table == "StackObjectAttributes"):
     1042        #    fields += ", stackDetectRowID "
    10241043        sql  = "INSERT INTO " + table + " (" + fields + ") "
    10251044        sql += "SELECT " + fields + " FROM " + mainTable
Note: See TracChangeset for help on using the changeset viewer.