mistercrunch commented on a change in pull request #11348:
URL:
https://github.com/apache/incubator-superset/pull/11348#discussion_r508983070
##########
File path: superset/sql_parse.py
##########
@@ -111,10 +111,13 @@ def is_select(self) -> bool:
return self._parsed[0].get_type() == "SELECT"
def is_explain(self) -> bool:
- # Parsing SQL statement for EXPLAIN and filtering out comments
- for statement in self.stripped().upper().splitlines():
- if statement.upper().startswith("EXPLAIN"):
- return True
+ # Remove comments
+ statements_without_comments = [statement.strip(" \t\n;") for statement
in self.stripped().upper().splitlines() if not statement.startswith("--")]
Review comment:
`sqlparse.format` offers a `strip_comments` option that will also take
care of `/*this*/` and probably more.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]