superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Add context to templates / respect slice timeout (#4673)
Date Thu, 05 Apr 2018 16:58:20 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 92230b8  Add context to templates / respect slice timeout (#4673)
92230b8 is described below

commit 92230b853566de2ee55c55c49a2b1b41e10a6d10
Author: DAOReady <34960884+daoready@users.noreply.github.com>
AuthorDate: Thu Apr 5 19:58:11 2018 +0300

    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 c8ee402..0f1640d 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 af8a149..7d0fabb 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 (

-- 
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.

Mime
View raw message