Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filters = cond and filters
else:
filters = cond
else:
break
i += 1
kw = {}
if filters:
kw['filter'] = filters
query.groupby(
datasource=ds.name,
granularity=granularity or 'all',
intervals=from_dttm + '/' + datetime.now().isoformat(),
dimensions=groupby,
aggregations={"count": client.doublesum(metric)},
#filter=filters,
limit_spec={
"type": "default",
"limit": limit,
"columns": [{
"dimension" : metric,
"direction" : "descending",
},],
},
**kw
)
return query.export_pandas()
def autocomplete(self, datasource, column):
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)