john-bodley closed pull request #4590: Removing escape_sql so we dont double 
escape
URL: https://github.com/apache/incubator-superset/pull/4590
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/connectors/sqla/models.py 
b/superset/connectors/sqla/models.py
index 3b636e8fa2..ef8c68ebb3 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -432,8 +432,6 @@ def get_from_clause(self, template_processor=None, 
db_engine_spec=None):
             from_sql = self.sql
             if template_processor:
                 from_sql = template_processor.process_template(from_sql)
-            if db_engine_spec:
-                from_sql = db_engine_spec.escape_sql(from_sql)
             from_sql = sqlparse.format(from_sql, strip_comments=True)
             return TextAsFrom(sa.text(from_sql), []).alias('expr_qry')
         return self.get_sqla_table()
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 73f8677293..e026ccfb39 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -145,11 +145,6 @@ def _allowed_file(filename):
 
         BaseEngineSpec.df_to_db(**df_to_db_kwargs)
 
-    @classmethod
-    def escape_sql(cls, sql):
-        """Escapes the raw SQL"""
-        return sql
-
     @classmethod
     def convert_dttm(cls, target_type, dttm):
         return "'{}'".format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
@@ -552,10 +547,6 @@ def adjust_database_uri(cls, uri, selected_schema=None):
             uri.database = database
         return uri
 
-    @classmethod
-    def escape_sql(cls, sql):
-        return re.sub(r'%%|%', '%%', sql)
-
     @classmethod
     def convert_dttm(cls, target_type, dttm):
         tt = target_type.upper()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to