Changeset 37917 for trunk/ippToPsps/jython/stackbatch.py
- Timestamp:
- Feb 20, 2015, 1:19:35 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/stackbatch.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/stackbatch.py
r37763 r37917 293 293 self.generateRandomIDs() 294 294 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") 295 298 self.generateStackDetectRowIDsAndPspsUniqueIDs() 299 self.logger.infoPair("Dropping row column from", "StackObjectThin table") 300 self.scratchDb.dropColumn("StackObjectThin", "row") 301 296 302 297 303 # add indexes StackObjectThin … … 372 378 self.logger.errorPair('failed sql: ', sql) 373 379 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 374 390 375 391 self.tablesToExport.append("StackObjectThin") … … 756 772 757 773 minRadius = 1 758 maxRadius = 10774 maxRadius = 9 759 775 if tablename == 'StackApFlx': 760 776 minRadius = 3 … … 765 781 766 782 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]: 768 784 if radius < minRadius: continue 769 785 if radius > maxRadius: continue … … 950 966 951 967 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 956 974 try: self.scratchDb.execute(sql) 957 975 except: … … 1010 1028 self.scratchDb.addColumn(table, filter + "haveData", "tinyint") 1011 1029 1012 fields = "objID, ippObjID, randomStackObjID, primaryDetection, bestDetection, uniquePspsSTID, "1030 fields = "objID, ippObjID, randomStackObjID, primaryDetection, bestDetection, uniquePspsSTID, StackDetectRowID, " 1013 1031 1014 1032 for i in range(len(self.filters)): … … 1016 1034 fields += filter + "ippDetectID, " 1017 1035 fields += filter + "stackDetectID, " 1036 # fields += filter + "StackDetectRowID, " 1018 1037 fields += filter + "stackMetaID " # careful here: do not add comma to last entry 1019 1038 if (i < len(self.filters) - 1): 1020 1039 fields += ", " 1021 1040 1022 if (table == "StackObjectAttributes"):1023 fields += ", stackDetectRowID "1041 #if (table == "StackObjectAttributes"): 1042 # fields += ", stackDetectRowID " 1024 1043 sql = "INSERT INTO " + table + " (" + fields + ") " 1025 1044 sql += "SELECT " + fields + " FROM " + mainTable
Note:
See TracChangeset
for help on using the changeset viewer.
