def getRecordsByParserID(self, parserID, minDayTimestamp = None, maxDayTimestamp = None):
        results = OrderedDict()
        if self.database.isOpen():
            #SELECT f.timestamp, f.processed, pd.* FROM parser p, forecast f, parserData pd WHERE p.name='ForecastIO Parser' AND p.id == pd.parserID AND f.id == pd.forecastID ORDER BY f.id DESC, pd.timestamp DESC;
            if minDayTimestamp and minDayTimestamp:
                records = self.database.execute("SELECT f.timestamp, f.processed, pd.* FROM forecast f, parserData pd "\
                                                "WHERE pd.parserID==? AND f.id == pd.forecastID AND ?<=pd.timestamp AND pd.timestamp<? "\
                                                "ORDER BY f.id DESC, pd.timestamp ASC", (parserID, minDayTimestamp, maxDayTimestamp))
            elif minDayTimestamp:
                records = self.database.execute("SELECT f.timestamp, f.processed, pd.* FROM forecast f, parserData pd "\
                                                "WHERE pd.parserID==? AND f.id == pd.forecastID AND ?<=pd.timestamp "\
                                                "ORDER BY f.id DESC, pd.timestamp ASC", (parserID, minDayTimestamp))
            elif maxDayTimestamp:
                records = self.database.execute("SELECT f.timestamp, f.processed, pd.* FROM forecast f, parserData pd "\
                                                "WHERE pd.parserID==? AND f.id == pd.forecastID AND pd.timestamp<? "\
                                                "ORDER BY f.id DESC, pd.timestamp ASC", (parserID, maxDayTimestamp))
            else:
                records = self.database.execute("SELECT f.timestamp, f.processed, pd.* FROM forecast f, parserData pd "\
                                                "WHERE pd.parserID==? AND f.id == pd.forecastID "\
                                                "ORDER BY f.id DESC, pd.timestamp ASC", (parserID, ))
            for row in records:
                forecast = RMForecastInfo(row[2], row[0], row[1])

                weatherData = RMWeatherData(row[4])
                weatherData.temperature = row[5]
                weatherData.minTemperature = row[6]
                weatherData.maxTemperature = row[7]
                weatherData.rh = row[8]
                weatherData.minRh = row[9]
                weatherData.maxRh = row[10]
                weatherData.wind = row[11]
                weatherData.solarRad = row[12]
                weatherData.skyCover = row[13]
                weatherData.rain = row[14]
                weatherData.et0 = row[15]
                weatherData.pop = row[16]
                weatherData.qpf = row[17]
                weatherData.condition = row[18]
                weatherData.pressure = row[19]
                weatherData.dewPoint = row[20]
                weatherData.userData = row[21]

                dayTimestamp = rmGetStartOfDay(weatherData.timestamp)

                forecastValues = None
                if forecast in results:
                    forecastValues = results[forecast]
                else:
                    forecastValues = OrderedDict()
                    results[forecast] = forecastValues

                dailyValues = None
                if dayTimestamp in forecastValues:
                    dailyValues = forecastValues[dayTimestamp]
                else:
                    dailyValues = []
                    forecastValues[dayTimestamp] = dailyValues

                dailyValues.append(weatherData)

        return results
    def getRecordsForKey(self, key, ignoreDisabledParser = False):
        ### key[0] is forecastID, key[1] is parserID
        if self.database.isOpen():
            allRecords = []

            if ignoreDisabledParser:
                records = self.database.execute("SELECT pd.* from parserData pd, parser p WHERE pd.forecastID=? AND pd.parserID=? AND pd.parserID=p.ID AND p.enabled<>0", (key[0], key[1], ))
            else:
                records = self.database.execute("SELECT * from parserData WHERE forecastID=? AND parserID=?", (key[0], key[1], ))
            for row in records:
                weatherData = RMWeatherData(row[2])
                weatherData.temperature = row[3]
                weatherData.minTemperature = row[4]
                weatherData.maxTemperature = row[5]
                weatherData.rh = row[6]
                weatherData.minRh = row[7]
                weatherData.maxRh = row[8]
                weatherData.wind = row[9]
                weatherData.solarRad = row[10]
                weatherData.skyCover = row[11]
                weatherData.rain = row[12]
                weatherData.et0 = row[13]
                weatherData.pop = row[14]
                weatherData.qpf = row[15]
                weatherData.condition = row[16]
                weatherData.pressure = row[17]
                weatherData.dewPoint = row[18]
                weatherData.userData = row[19]

                allRecords.append(weatherData)
            return allRecords
        return None