Next / Previous / Contents / NM Tech homepage

6.29. CBCData.getEffort(): Retrieve a specific effort record

pycbc.py
# - - -   C B C D a t a . g e t E f f o r t

    def getEffort(self, year_no, year_key):
        '''Retrieve one effort record.
        '''
        try:
            row = (self.s.query(self.Effort)
                   .filter_by(year_no=year_no, year_key=year_key)
                   .one())
        except exc.NoResultFound:
            raise KeyError("Unknown effort: %s-%s" % (year_no, year_key))
        except exc.MultipleResultsFound:
            raise KeyError("Not unique: %s-%s" % (year_no, year_key))
        return row