From 92230b853566de2ee55c55c49a2b1b41e10a6d10 Mon Sep 17 00:00:00 2001 From: DAOReady <34960884+daoready@users.noreply.github.com> Date: Thu, 5 Apr 2018 19:58:11 +0300 Subject: [PATCH] Add context to templates / respect slice timeout (#4673) * added context to templates to be able to use filters in SQL * respect slice timeout in favor of others * added trailing comma --- superset/connectors/sqla/models.py | 3 +++ superset/viz.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index c8ee40269..0f1640dc4 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -477,6 +477,9 @@ class SqlaTable(Model, BaseDatasource): 'metrics': metrics, 'row_limit': row_limit, 'to_dttm': to_dttm, + 'filter': filter, + 'columns': {col.column_name: col for col in self.columns}, + } template_processor = self.get_template_processor(**template_kwargs) db_engine_spec = self.database.db_engine_spec diff --git a/superset/viz.py b/superset/viz.py index af8a149e2..7d0fabb92 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -279,6 +279,8 @@ class BaseViz(object): @property def cache_timeout(self): + if self.form_data.get('cache_timeout'): + return int(self.form_data.get('cache_timeout')) if self.datasource.cache_timeout: return self.datasource.cache_timeout if (