Skip to content

Commit

Permalink
Fixing filter for timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jul 22, 2015
1 parent 4bb313c commit 056be73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Binary file modified app.db
Binary file not shown.
2 changes: 2 additions & 0 deletions app/views.py
Expand Up @@ -19,6 +19,7 @@ class ColumnInlineView(CompactCRUDMixin, ModelView):
'column_name', 'type', 'groupby', 'count_distinct',
'sum', 'min', 'max']
can_delete = False
page_size = 100
appbuilder.add_view_no_menu(ColumnInlineView)


Expand All @@ -30,6 +31,7 @@ class MetricInlineView(CompactCRUDMixin, ModelView):
'datasource', 'json']
add_columns = [
'metric_name', 'verbose_name', 'metric_type', 'datasource', 'json']
page_size = 100
appbuilder.add_view_no_menu(MetricInlineView)


Expand Down
8 changes: 7 additions & 1 deletion app/viz.py
Expand Up @@ -260,6 +260,7 @@ def bake_query(self):
"""
client = utils.get_pydruid_client()
qry = self.query_obj()
orig_filter = qry['filter'] if 'filter' in qry else ''
qry['granularity'] = "all"
client.groupby(**qry)
df = client.export_pandas()
Expand All @@ -279,7 +280,12 @@ def bake_query(self):
qry = self.query_obj()
if filters:
ff = Filter(type="or", fields=filters)
qry['filter'] = ff
if not orig_filter:
qry['filter'] = ff
else:
qry['filter'] = Filter(type="and", fields=[
Filter.build_filter(ff),
Filter.build_filter(orig_filter)])
del qry['limit_spec']
client.groupby(**qry)
return client.export_pandas()
Expand Down

0 comments on commit 056be73

Please sign in to comment.