aminghadersohi commented on code in PR #44721:
URL: https://github.com/apache/superset/pull/44721#discussion_r4142853414
##########
superset/db_engine_specs/exasol.py:
##########
@@ -85,6 +133,29 @@ class ExasolEngineSpec(BaseEngineSpec): # pylint:
disable=abstract-method
TimeGrain.YEAR: "DATE_TRUNC('year', {col})",
}
+ @classmethod
+ def _extract_error_message(cls, ex: Exception) -> str:
+ """Extract the server diagnostic without driver-echoed SQL."""
+ message = super()._extract_error_message(ex)
+ # Strip SQL before looking for a verbose message field: SQL literals
+ # can themselves contain text resembling a driver envelope.
+ message = re.split(
+ r"(?m)^[ \t]*(?:query[ \t]*=>|\[SQL:|\[parameters:)",
+ message,
+ maxsplit=1,
+ )[0]
+ if match := re.search(r"(?m)^[ \t]*message[ \t]*=>[ \t]*", message):
+ # PyExasol prints the message first, then its fixed
connection/query
+ # fields. Only those field names end the message, so a diagnostic
+ # line that itself contains ``=>`` is kept.
+ message = re.split(
+ r"(?m)^[ \t]*(?:(?:dsn|user|schema|session_id|code|query)[
\t]*=>"
+ r"|\)[ \t]*$)",
+ message[match.end() :],
+ maxsplit=1,
+ )[0]
+ return message.strip()
Review Comment:
Fixed in b54afcb801a2ce6a1e4a52047b94d480ec38d77c. Empty or whitespace-only
`message =>` fields fall back to the SQL-stripped envelope, preserving `code =>
42000` without exposing the echoed query. Added regression cases for empty,
whitespace-only, and multiline-whitespace diagnostics, both as plain exceptions
and SQLAlchemy DBAPIError wrappers. All 85 focused tests pass; pre-commit
passes, including mypy and pylint.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]