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
评论列表
文章目录