betodealmeida commented on code in PR #27858: URL: https://github.com/apache/superset/pull/27858#discussion_r1548811191
########## superset/sql_parse.py: ########## @@ -752,11 +752,19 @@ def _extract_tables_from_sql(self) -> set[Table]: statements = parse(self.stripped(), dialect=self._dialect) except SqlglotError as ex: logger.warning("Unable to parse SQL (%s): %s", self._dialect, self.sql) - dialect = self._dialect or "generic" + + if isinstance(ex, ParseError): + error = ex.errors[0] + suffix = f"""Error parsing near '{error["highlight"]}' at line {error["line"]}:{error["col"]}""" # pylint: disable=line-too-long Review Comment: Could simplify to: ```suggestion suffix = "Error parsing near '{highlight}' at line {line}:{col}".format(**error) ``` Thought the linter usually complain of using `.format()`. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org