From 2eaa2ca19c757db61122d3024ac9460d87cfe76c Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Wed, 7 Feb 2018 14:33:04 -0800 Subject: [PATCH] [line] improve feature (#4363) 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 c50027627c6f4..ebd0c788b9d49 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -1073,6 +1073,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