This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/0.38 by this push:
     new 131b516  Revert "fix: disable jinja2 SQL templating"
131b516 is described below

commit 131b51656ccb3721cc2504a3636d7b145e22c5d1
Author: Ville Brofeldt <[email protected]>
AuthorDate: Wed Oct 28 11:01:34 2020 +0200

    Revert "fix: disable jinja2 SQL templating"
    
    This reverts commit 922b8aa7c9f541fd93943af0f3ed7e8186134bf0.
---
 superset/config.py            |  1 -
 superset/jinja_context.py     | 21 ++++-----------------
 tests/superset_test_config.py |  7 +------
 3 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/superset/config.py b/superset/config.py
index 52566af..71c1e99 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -298,7 +298,6 @@ DEFAULT_FEATURE_FLAGS: Dict[str, bool] = {
     "CLIENT_CACHE": False,
     "ENABLE_EXPLORE_JSON_CSRF_PROTECTION": False,
     "ENABLE_DASHBOARD_ETAG_HEADER": False,
-    "ENABLE_TEMPLATE_PROCESSING": False,
     "KV_STORE": False,
     "PRESTO_EXPAND_DATA": False,
     # Exposes API endpoint to compute thumbnails
diff --git a/superset/jinja_context.py b/superset/jinja_context.py
index 988aea8..bc35dbe 100644
--- a/superset/jinja_context.py
+++ b/superset/jinja_context.py
@@ -23,7 +23,7 @@ from flask import g, request
 from jinja2.sandbox import SandboxedEnvironment
 
 from superset import jinja_base_context
-from superset.extensions import feature_flag_manager, jinja_context_manager
+from superset.extensions import jinja_context_manager
 from superset.utils.core import convert_legacy_filters_into_adhoc, 
merge_extra_filters
 
 if TYPE_CHECKING:
@@ -247,16 +247,6 @@ class BaseTemplateProcessor:  # pylint: 
disable=too-few-public-methods
         return template.render(kwargs)
 
 
-class NoOpTemplateProcessor(
-    BaseTemplateProcessor
-):  # pylint: disable=too-few-public-methods
-    def process_template(self, sql: str, **kwargs: Any) -> str:
-        """
-        Makes processing a template a noop
-        """
-        return sql
-
-
 class PrestoTemplateProcessor(BaseTemplateProcessor):
     """Presto Jinja context
 
@@ -334,10 +324,7 @@ def get_template_processor(
     query: Optional["Query"] = None,
     **kwargs: Any,
 ) -> BaseTemplateProcessor:
-    if feature_flag_manager.is_feature_enabled("ENABLE_TEMPLATE_PROCESSING"):
-        template_processor = template_processors.get(
-            database.backend, BaseTemplateProcessor
-        )
-    else:
-        template_processor = NoOpTemplateProcessor
+    template_processor = template_processors.get(
+        database.backend, BaseTemplateProcessor
+    )
     return template_processor(database=database, table=table, query=query, 
**kwargs)
diff --git a/tests/superset_test_config.py b/tests/superset_test_config.py
index 8d03115..513d3d9 100644
--- a/tests/superset_test_config.py
+++ b/tests/superset_test_config.py
@@ -49,12 +49,7 @@ HIVE_POLL_INTERVAL = 0.1
 
 SQL_MAX_ROW = 666
 SQLLAB_CTAS_NO_LIMIT = True  # SQL_MAX_ROW will not take affect for the CTA 
queries
-FEATURE_FLAGS = {
-    "foo": "bar",
-    "KV_STORE": True,
-    "SHARE_QUERIES_VIA_KV_STORE": True,
-    "ENABLE_TEMPLATE_PROCESSING": True,
-}
+FEATURE_FLAGS = {"foo": "bar", "KV_STORE": True, "SHARE_QUERIES_VIA_KV_STORE": 
True}
 
 
 def GET_FEATURE_FLAGS_FUNC(ff):

Reply via email to