IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33760 for trunk


Ignore:
Timestamp:
Apr 11, 2012, 11:56:08 AM (14 years ago)
Author:
rhenders
Message:

new code to populate ObjectCalColor, but commented outfor now; fix for issue of STILTS renaming dec to dec_ (as it is a MySQL reserved word). forcing back to dec again so as not to breal PSPS load

File:
1 edited

Legend:

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

    r33746 r33760  
    7878    def alterPspsTables(self):
    7979
     80        # index objID column
    8081        self.scratchDb.makeColumnUnique("Object", "objID")
    8182
     83        # dec is reserved in MySQL, so STILTS replaces if with dec_, which PSPS doesn't like. so, force it back again
     84        self.scratchDb.execute("ALTER TABLE Object CHANGE dec_ `dec` double")
     85
    8286        return True
    8387
     
    97101
    98102        # list of all filters we are interested in
    99         allFilters = ['g', 'r', 'i', 'z', 'y']
     103        allFilters = ['g', 'r', 'i', 'z', 'y', ]
    100104       
    101105        # this loop looks into the DVO Photcodes tables and gets the 'CODE' for each the filters above that are listed
     
    148152            self.logger.errorPair("Couldn't calculate colors", sql)
    149153
    150 
    151     '''
    152     Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
    153     '''
    154     def populatePspsTables(self):
     154    '''
     155    Populates the Object table
     156    '''
     157    def populateObjectTable(self):
    155158
    156159        cptTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cpt")
    157160        cpsTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cps")
    158161
    159         self.logger.infoPair("Inserting objects from", "cpt")
     162        self.logger.infoPair("Populating", "ObjectCalColor")
     163        self.logger.infoPair("Inserting objects from", "cpt file")
    160164        sql = "INSERT IGNORE INTO Object (\
    161165               objID \
     
    164168               ,surveyID \
    165169               ,ra \
    166                ,dec_ \
     170               ,`dec` \
    167171               ,raErr \
    168172               ,decErr \
    169173               ,nDetections \
     174               ,dataRelease \
    170175               ) \
    171176               SELECT \
     
    179184               ,DEC_ERR \
    180185               ,NMEASURE \
     186               , " + str(self.config.dataRelease) + "\
    181187               FROM " + cptTableName
    182188
     
    185191        except:
    186192            self.logger.errorPair("Couldn't populate Object table", sql)
     193            return False
     194
    187195
    188196        # add row count columns so we can perform joins to get colors
     
    206214        return True
    207215
     216    '''
     217    Populates the ObjectCalColor table
     218    '''
     219    def populateObjectCalColorTable(self):
     220
     221        self.logger.infoPair("Populating", "ObjectCalColor")
     222
     223        sql = "INSERT INTO ObjectCalColor ( \
     224               objID \
     225               ,ippObjID \
     226               ,dataRelease \
     227               ) \
     228               SELECT \
     229               objID \
     230               ,ippObjID \
     231               ,dataRelease \
     232               FROM Object"
     233        try:
     234            self.scratchDb.execute(sql)
     235        except:
     236            self.logger.errorPair("Couldn't populate ObjectCalColor table", sql)
     237            return False
     238
     239        return True
     240
     241    '''
     242    Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
     243    '''
     244    def populatePspsTables(self):
     245
     246        if not self.populateObjectTable(): return False
     247        #if not self.populateObjectCalColorTable(): return False
     248
     249        return True
     250
Note: See TracChangeset for help on using the changeset viewer.