From 1c429b27bc425aa8ba0f8cc6b43887cfb91dcd15 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 28 Nov 2016 16:25:09 -0800 Subject: [PATCH] Fixing issue #1689 (#1696) --- superset/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset/models.py b/superset/models.py index d60bca49e58f1..0dc262f737363 100644 --- a/superset/models.py +++ b/superset/models.py @@ -1063,9 +1063,9 @@ def visit_column(element, compiler, **kw): dttm_col = cols[granularity] time_grain = extras.get('time_grain_sqla') - timestamp = dttm_col.get_timestamp_expression(time_grain) if is_timeseries: + timestamp = dttm_col.get_timestamp_expression(time_grain) select_exprs += [timestamp] groupby_exprs += [timestamp] @@ -1119,7 +1119,7 @@ def visit_column(element, compiler, **kw): qry = qry.limit(row_limit) - if timeseries_limit and groupby: + if is_timeseries and timeseries_limit and groupby: # some sql dialects require for order by expressions # to also be in the select clause inner_select_exprs += [main_metric_expr]