You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/04/05 16:58:20 UTC

[incubator-superset] branch master updated: Add context to templates / respect slice timeout (#4673)

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 <34...@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.