aboutsummaryrefslogtreecommitdiff
blob: 6cef893ad5c283f0a344c181338f51784f4b06e1 (plain)
1
2
3
4
5
6
7
8
9
10
from config import render, db

class Keyword(object):
    def GET(self):
        keyword_count = db.query('SELECT KEYWORD, COUNT(DISTINCT IPKEY) AS PACKAGES, COUNT(DISTINCT UUID) AS HOSTS FROM GLOBAL_KEYWORDS NATURAL JOIN KEYWORDS NATURAL JOIN INSTALLED_PACKAGES GROUP BY KEYWORD')
        keyword_data = dict()
        for t in keyword_count:
            keyword_data[t['KEYWORD']] = {'HOSTS':t['HOSTS'], 'PACKAGES':t['PACKAGES']}
        return render.keyword(keyword_data)