Ejemplo n.º 1
0
 def autocomplete(self, datasource, column):
     """used for filter autocomplete"""
     client = utils.get_pydruid_client()
     top = client.topn(
         datasource=datasource,
         granularity='all',
         intervals='2013-10-04/2020-10-10',
         aggregations={"count": doublesum("count")},
         dimension=column,
         metric='count',
         threshold=1000,
     )
     values = sorted([d[column] for d in top[0]['result']])
     return json.dumps(values)
Ejemplo n.º 2
0
 def autocomplete(self, datasource, column):
     """used for filter autocomplete"""
     client = utils.get_pydruid_client()
     top = client.topn(
         datasource=datasource,
         granularity='all',
         intervals='2013-10-04/2020-10-10',
         aggregations={"count": doublesum("count")},
         dimension=column,
         metric='count',
         threshold=1000,
     )
     values = sorted([d[column] for d in top[0]['result']])
     return json.dumps(values)