コード例 #1
0
    def _get_query_data(self, query_name, params=None) -> Tuple[Dict, Dict]:
        query = get_redshift_query(query_name)
        parameterized_query = query.build_full_params(params or dict())
        try:
            trigger_if_stale(parameterized_query)
        except OSError as err:
            get_logger().warning("Failed to trigger stale query refresh: " +
                                 str(err))

        if not parameterized_query.result_available:
            raise QueryDataNotAvailableException()
        response = parameterized_query.response_payload
        return response["series"]["data"], response["series"]["metadata"]
コード例 #2
0
    def _get_redshift_query_data(self):

        # Fetch the results for the target Redshift query, trigger a refresh as necessary,
        # and cache the response for subsequent calls.

        if not self.redshift_query_data:
            parameterized_query = self.get_parameterized_query()
            try:
                trigger_if_stale(parameterized_query)
            except OSError as err:
                get_logger().warning(
                    "Failed to trigger stale query refresh: " + str(err))

            if not parameterized_query.result_available:
                raise QueryDataNotAvailableException()

            response = parameterized_query.response_payload

            self.redshift_query_data = self.filter_parameterized_query_response(
                response["series"]["data"])

        return self.redshift_query_data
コード例 #3
0
ファイル: test_views.py プロジェクト: dbrudner/HSReplay.net
 def mock_get_query_data(self, query_name, game_type):
     raise QueryDataNotAvailableException()