You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/08/24 21:31:52 UTC
[superset] branch fix-sql-tp updated: lit
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch fix-sql-tp
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/fix-sql-tp by this push:
new 0289856dd4 lit
0289856dd4 is described below
commit 0289856dd493cb491acdb31154a7b75835959a53
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Aug 24 14:31:32 2022 -0700
lit
---
superset/models/helpers.py | 2 +-
superset/models/sql_lab.py | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index 1ce534b593..e0acb3d24e 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -1377,7 +1377,7 @@ class ExploreMixin: # pylint: disable=too-many-public-methods
applied_template_filters: List[str] = []
template_kwargs["removed_filters"] = removed_filters
template_kwargs["applied_filters"] = applied_template_filters
- template_processor = None # self.get_template_processor(**template_kwargs)
+ template_processor = self.get_template_processor(**template_kwargs)
db_engine_spec = self.db_engine_spec
prequeries: List[str] = []
orderby = orderby or []
diff --git a/superset/models/sql_lab.py b/superset/models/sql_lab.py
index d0e0470d4b..1db8acac54 100644
--- a/superset/models/sql_lab.py
+++ b/superset/models/sql_lab.py
@@ -53,6 +53,10 @@ from superset.sql_parse import CtasMethod, ParsedQuery, Table
from superset.sqllab.limiting_factor import LimitingFactor
from superset.superset_typing import ResultSetColumnType
from superset.utils.core import GenericDataType, QueryStatus, user_label
+from superset.jinja_context import (
+ BaseTemplateProcessor,
+ get_template_processor,
+)
if TYPE_CHECKING:
from superset.db_engine_specs import BaseEngineSpec
@@ -126,6 +130,9 @@ class Query(
__table_args__ = (sqla.Index("ti_user_id_changed_on", user_id, changed_on),)
+ def get_template_processor(self, **kwargs: Any) -> BaseTemplateProcessor:
+ return get_template_processor(query=self, database=self.database, **kwargs)
+
def to_dict(self) -> Dict[str, Any]:
return {
"changedOn": self.changed_on,