(self, db, params)
return self._country_aggregate
Country aggregate for the passed link id
        :param db:
        :param params:
        :return:
Country aggregate for the passed link id
        :param db:
        :param params:
        :return:
Country aggregate for the passed link id : param db : : param params : : return :
def country_aggregate(self, db, params):
        """Country aggregate for the passed link id
        :param db:
        :param params:
        :return:
        """
        if self._country_aggregate is None:
            qry = text("""
                SELECT COALESCE(country, 'others'), COUNT(*)
                From clickmeta
                WHERE link_id=:link_id
                GROUP BY country
                ORDER BY count(*) DESC""")
            self._country_aggregate = dict(db.execute(qry, params).fetchall())
        return self._country_aggregate
def country_aggregate ( self , db , params ) : if self . _country_aggregate is None : qry = text ( """
                SELECT COALESCE(country, 'others'), COUNT(*)
                From clickmeta
                WHERE link_id=:link_id
                GROUP BY country
                ORDER BY count(*) DESC""" ) self . _country_aggregate = dict ( db . execute ( qry , params ) . fetchall ( ) ) return self . _country_aggregate