You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/17 08:52:27 UTC

[GitHub] [superset] dpgaspar commented on a change in pull request #13153: fix: engines that don't support comments

dpgaspar commented on a change in pull request #13153:
URL: https://github.com/apache/superset/pull/13153#discussion_r577427687



##########
File path: superset/db_engine_specs/base.py
##########
@@ -933,6 +933,9 @@ def execute(cls, cursor: Any, query: str, **kwargs: Any) -> None:
         :param kwargs: kwargs to be passed to cursor.execute()
         :return:
         """
+        if not cls.allows_sql_comments:
+            query = sql_parse.ParsedQuery(query).strip_comments()

Review comment:
       This needs to happen before any query execution on engines that don't support comments. Just instantiating `ParsedQuery` is much less intensive now, but yes some overhead exist.
   We used to have default comments on SQLab for example, probably was considered safe since comments are an ANSI SQL 92 standard. `allows_query_mutator` is a good option but seems more evasive
   
   I've made a feature request on opendistro SQL:
   https://github.com/opendistro-for-elasticsearch/sql/issues/1051
   
   ^^^ Community support is awesome on opendistro SQL, and they are heavily developing and about to release a major change.
   
   We can make a quick char check before instantiating `ParsedQuery`, not pretty, but would avoid unnecessary processing on all statements
    




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org