IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 10, 2015, 12:40:44 PM (11 years ago)
Author:
eugene
Message:

make code less forgiving: sql execute aborts on failures; deal with various hidden problems: add IF EXISTS to drop table operations to avoid raising unneeded error, make sure tables exist before trying to add indexes, test for existence of the stack _xsrc, _xfit, etc tables (and skip if missing); fix sqlLine.group to cast inputs to string before performing string ops; getKeyFloat now returns a float value which is safe with sqlLine.group, but can be used in a math expression; use python math. operators as needed (sqrt, fabs); fulltest.sh runs for camera, stack, object stages; update dvoSkyTable to use REGION_ID instead of special word INDEX; add existsClient method (avoid using mysql failure as a test for table existence); no need to test for exceptions to sql.execute since we abort on failure; replace esoteric SQL with dropTable calls; trap errors in stilts.treads in setupScratchdb; drop StackObjecThin and StackDetOffMeta along with other stack scratch tables

File:
1 edited

Legend:

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

    r38823 r38837  
    475475        # drop and create Images table
    476476        self.logger.infoPair("Creating DVO table", dvoImagesTable)
    477         sql = "DROP TABLE " + dvoImagesTable
    478 
    479         try: self.execute(sql)
    480         except: pass
    481        
     477        self.dropTable(dvoImagesTable)
     478
    482479        sql = "CREATE TABLE " + dvoImagesTable + " ( \
    483480               SOURCE_ID SMALLINT, \
     
    495492        # now detection table
    496493        self.logger.infoPair("Dropping DVO table", dvoDetectionTable)
    497         sql = "DROP TABLE " + dvoDetectionTable + " IF EXISTS"
    498         try: self.execute(sql)
    499         except:
    500             self.logger.errorPair("problem dropping DVO table", dvoDetectionTable)
    501             pass
     494        self.dropTable(dvoDetectionTable)
    502495
    503496        self.logger.infoPair("Creating DVO table", "dvoDetection")
     
    514507               decErr FLOAT, \
    515508               zp FLOAT, \
     509               zpFactor FLOAT, \
    516510               telluricExt FLOAT, \
    517511               airmass FLOAT, \
     
    554548
    555549               tableName = self.getDbFriendlyTableName(region + "." + fileType)
    556                sql = "DROP TABLE " + tableName
    557                try: self.execute(sql)
    558                except:
    559                     self.logger.errorPair("Unable to drop table", tableName)
    560                     pass
     550               self.dropTable(tableName)
    561551
    562552        # deletedDetectionCount = detectionCount - self.getRowCount(self.dvoDetectionTable)
     
    583573
    584574       sql = "set @@max_heap_table_size = " + str(tableSize)
    585        try: self.execute(sql)
    586        except:
    587            self.logger.errorPair("Unable to set max MEMORY table size for ", self.dvoDetectionTable)
    588            return False
     575       self.execute(sql)
    589576
    590577       # create detections table
    591578       self.logger.infoPair("Creating table", self.dvoDetectionTable)
    592579       sql = "CREATE TABLE " + self.dvoDetectionTable + " LIKE dvoDetection"
    593        try: self.execute(sql)
    594        except:
    595            self.logger.errorPair("Unable to create table", self.dvoDetectionTable)
    596            return False
     580       self.execute(sql)
    597581
    598582       # XXX changing the dvoDetectionFull table to MEMORY
     
    660644
    661645        sql = "SELECT \
    662                INDEX_, \
     646               REGION_ID, \
    663647               R_MIN+ (R_MAX - R_MIN)/2.0, \
    664648               D_MIN + (D_MAX - D_MIN)/2.0, \
     
    689673
    690674        region = ""
    691         sql = "SELECT NAME FROM " + self.dvoSkyTable + " WHERE INDEX_ = " + str(index)
     675        sql = "SELECT NAME FROM " + self.dvoSkyTable + " WHERE REGION_ID = " + str(index)
    692676        try:
    693677            rs = self.executeQuery(sql)
Note: See TracChangeset for help on using the changeset viewer.