Skip to content

Commit

Permalink
Adding tests for adhoc metric as timeseries_limit_metric
Browse files Browse the repository at this point in the history
  • Loading branch information
michellethomas committed Jun 1, 2018
1 parent 6f05b48 commit 4776828
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions superset/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,35 @@ def load_birth_names():
},
viz_type="big_number_total",
granularity_sqla="ds")),
Slice(
slice_name='Top 10 California Names Timeseries',
viz_type='line',
datasource_type='table',
datasource_id=tbl.id,
params=get_slice_json(
defaults,
metrics=[{
'expressionType': 'SIMPLE',
'column': {
'column_name': 'num_california',
'expression': "CASE WHEN state = 'CA' THEN num ELSE 0 END",
},
'aggregate': 'SUM',
'label': 'SUM(num_california)',
}],
viz_type='line',
granularity_sqla='ds',
groupby=['name'],
timeseries_limit_metric={
'expressionType': 'SIMPLE',
'column': {
'column_name': 'num_california',
'expression': "CASE WHEN state = 'CA' THEN num ELSE 0 END",
},
'aggregate': 'SUM',
'label': 'SUM(num_california)',
},
limit='10')),
]
for slc in slices:
merge_slice(slc)
Expand Down

0 comments on commit 4776828

Please sign in to comment.