From a4417b9229710fb3ba6f6409f93328134c51c4c1 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 10 Apr 2017 13:53:40 -0700 Subject: [PATCH] Make form_data dict a macro --- superset/connectors/druid/models.py | 2 +- superset/connectors/sqla/models.py | 4 +++- superset/jinja_context.py | 1 + superset/viz.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py index 61cb3f019f346..f03af3d4c90d6 100644 --- a/superset/connectors/druid/models.py +++ b/superset/connectors/druid/models.py @@ -709,7 +709,7 @@ def get_query_str( # noqa / druid orderby=None, extras=None, # noqa select=None, # noqa - columns=None, phase=2, client=None): + columns=None, phase=2, client=None, form_data=None): """Runs a query against Druid and returns a dataframe. This query interface is common to SqlAlchemy and Druid diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index 92942603bd197..903182de46b47 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -346,7 +346,8 @@ def get_sqla_query( # sqla inner_to_dttm=None, orderby=None, extras=None, - columns=None): + columns=None, + form_data=None): """Querying any sqla table from this common interface""" template_kwargs = { @@ -355,6 +356,7 @@ def get_sqla_query( # sqla 'metrics': metrics, 'row_limit': row_limit, 'to_dttm': to_dttm, + 'form_data': form_data, } template_processor = self.get_template_processor(**template_kwargs) diff --git a/superset/jinja_context.py b/superset/jinja_context.py index 5bcbbd6a472f8..11764c027d978 100644 --- a/superset/jinja_context.py +++ b/superset/jinja_context.py @@ -82,6 +82,7 @@ def __init__(self, database=None, query=None, table=None, **kwargs): 'url_param': url_param, 'current_user_id': current_user_id, 'current_username': current_username, + 'form_data': {}, } self.context.update(kwargs) self.context.update(BASE_CONTEXT) diff --git a/superset/viz.py b/superset/viz.py index ae440ef949a18..eea74ec714485 100755 --- a/superset/viz.py +++ b/superset/viz.py @@ -178,6 +178,7 @@ def query_obj(self): 'timeseries_limit': limit, 'extras': extras, 'timeseries_limit_metric': timeseries_limit_metric, + 'form_data': form_data, } return d