DbProfilerRepository.py 文件源码

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

项目:Hecatoncheir 作者: snaga 项目源码 文件源码
def get_tags(self):
        """Get a list of tag names and number of tags associated with tables.

        Returns:
            list: a list of lists: [[tag,num of tables], ...]
        """
        log.trace("get_tags: start")

        query = """
SELECT tag_label,
       COUNT(*)
  FROM tags
 WHERE tag_label <> ''
 GROUP BY
       tag_label
 ORDER BY
       COUNT(*) DESC
"""

        tags = []
        try:
            cursor = self._conn.cursor()
            log.debug("get_tags: query = %s" % query)
            for r in cursor.execute(query):
                tags.append([r[0], r[1]])
        except Exception as e:
            log.trace("get_tags: " + unicode(e))
            raise InternalError(_("Could not get tag info: "),
                                query=query, source=e)

        log.trace("get_tags: end")
        return tags
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号