api.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:galaxia 作者: WiproOpenSourcePractice 项目源码 文件源码
def get_metrics(self, unit_type, sub_type):
        """
        Handler to get supported metrics for a unit_type
        :param unit_type:
        :param sub_type
        :return:
        """

        log.info("Request received to get supported metrics for unit_type %s and subtype %s" %(unit_type, sub_type) )
        conn = sql_helper.engine.connect()
        sql_query = query_list.GET_METRICS
        params = sub_type
        final_query =  sql_query % '"'+params+'"'
        try:
            #result = conn.execute(sql_query, params)
            result = conn.execute(final_query)
        except SQLAlchemyError as ex:
            return "Unable to get the metrics list because of database\
                   exception"

        log.info("Request to get supported metrics for %s successfully\
                 processed" % sub_type)

        return json.dumps(dict(result.fetchall()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号