From 05d205874611d8d3e9658e07700c6f328c674aaa Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 6 Feb 2018 15:28:41 -0800 Subject: [PATCH] [line] improve feature Require Since and Until parameter as they are needed to time shift --- superset/viz.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/superset/viz.py b/superset/viz.py index 6fc8cf9887095..c6d0760a8f452 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -1070,6 +1070,11 @@ def get_data(self, df): delta = utils.parse_human_timedelta(time_compare) query_object['inner_from_dttm'] = query_object['from_dttm'] query_object['inner_to_dttm'] = query_object['to_dttm'] + + if not query_object['from_dttm'] or not query_object['to_dttm']: + raise Exception(_( + '`Since` and `Until` time bounds should be specified ' + 'when using the `Time Shift` feature.')) query_object['from_dttm'] -= delta query_object['to_dttm'] -= delta