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
This commit is contained in:
DAOReady 2018-04-05 19:58:11 +03:00 committed by Maxime Beauchemin
parent df4ff05441
commit 92230b8535
2 changed files with 5 additions and 0 deletions

View File

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

View File

@ -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 (