aminghadersohi commented on code in PR #44721:
URL: https://github.com/apache/superset/pull/44721#discussion_r4139215565


##########
superset/db_engine_specs/exasol.py:
##########
@@ -27,6 +30,38 @@ class ExasolEngineSpec(BaseEngineSpec):  # pylint: 
disable=abstract-method
     engine_name = "Exasol"
     max_column_name_length = 128
 
+    # Keep the server's message from its keyword onwards, including the
+    # position/identifier. The passthrough placeholder has no translatable 
text.
+    custom_errors: dict[Pattern[str], tuple[str, SupersetErrorType, dict[str, 
Any]]] = {
+        re.compile(r"(?P<message>syntax error[^\n]*)", re.IGNORECASE): (

Review Comment:
   Fixed in 02262dbd9fb9967daca3bf6bd10dfa83fc80692d. Exasol normalizes the 
diagnostic before custom-error matching: query, SQL, and parameter tails are 
removed before extracting the verbose message field, and connection metadata is 
excluded. Regression coverage includes all four pattern-looking SQL strings, a 
multiline fake message field inside SQL, generic diagnostics, and SQLAlchemy 
StatementError wrappers. The focused suite passes all 78 tests; pre-commit 
passes, including mypy and pylint.



##########
superset/db_engine_specs/exasol.py:
##########
@@ -27,6 +30,38 @@ class ExasolEngineSpec(BaseEngineSpec):  # pylint: 
disable=abstract-method
     engine_name = "Exasol"
     max_column_name_length = 128
 
+    # Keep the server's message from its keyword onwards, including the
+    # position/identifier. The passthrough placeholder has no translatable 
text.
+    custom_errors: dict[Pattern[str], tuple[str, SupersetErrorType, dict[str, 
Any]]] = {
+        re.compile(r"(?P<message>syntax error[^\n]*)", re.IGNORECASE): (
+            "%(message)s",
+            SupersetErrorType.SYNTAX_ERROR,
+            {},
+        ),
+        re.compile(r"(?P<message>table [^\n]* does not exist[^\n]*)", 
re.IGNORECASE): (
+            "%(message)s",
+            SupersetErrorType.TABLE_DOES_NOT_EXIST_ERROR,
+            {},
+        ),
+        # Exasol reports a missing column as ``column <NAME> not found``. The
+        # keyword must start the diagnostic (not follow another word, as in
+        # ``object COLUMN not found``) and be followed by at most one 
identifier.
+        re.compile(
+            r'(?P<message>(?<![\w"] )(?<![\w.$"])column'
+            r'(?: (?:"[^"\n]*"|[\w.$]+))? not found[^\n]*)',

Review Comment:
   Handled in 02262dbd9fb9967daca3bf6bd10dfa83fc80692d with the small 
part(.part)* regex change. Added quoted-qualified, mixed quoted/unquoted, and 
unquoted-qualified test cases; the existing object/function near-miss cases 
still pass. This is defensive support for the proposed diagnostic shape, not a 
claim that a live Exasol instance was observed emitting it. All 78 focused 
tests pass.



##########
superset/db_engine_specs/exasol.py:
##########
@@ -27,6 +30,38 @@ class ExasolEngineSpec(BaseEngineSpec):  # pylint: 
disable=abstract-method
     engine_name = "Exasol"
     max_column_name_length = 128
 
+    # Keep the server's message from its keyword onwards, including the
+    # position/identifier. The passthrough placeholder has no translatable 
text.
+    custom_errors: dict[Pattern[str], tuple[str, SupersetErrorType, dict[str, 
Any]]] = {
+        re.compile(r"(?P<message>syntax error[^\n]*)", re.IGNORECASE): (
+            "%(message)s",
+            SupersetErrorType.SYNTAX_ERROR,
+            {},
+        ),
+        re.compile(r"(?P<message>table [^\n]* does not exist[^\n]*)", 
re.IGNORECASE): (
+            "%(message)s",
+            SupersetErrorType.TABLE_DOES_NOT_EXIST_ERROR,
+            {},
+        ),
+        # Exasol reports a missing column as ``column <NAME> not found``. The
+        # keyword must start the diagnostic (not follow another word, as in
+        # ``object COLUMN not found``) and be followed by at most one 
identifier.
+        re.compile(
+            r'(?P<message>(?<![\w"] )(?<![\w.$"])column'
+            r'(?: (?:"[^"\n]*"|[\w.$]+))? not found[^\n]*)',

Review Comment:
   This does not apply to the actual source at 
630971d245dd794c13f9bfd5baa218fff726f934: the raw strings contain 
single-backslash \w and \n escapes, not doubled backslashes. I extracted the 
pattern from that commit with ast.literal_eval and compiled it with re. It 
captures the complete "column MISSING_COL not found [line 1, column 8]" 
diagnostic, while "object COLUMN not found" and "function TO_COLUMN not found" 
both produce no match. The same cases remain covered in 
02262dbd9fb9967daca3bf6bd10dfa83fc80692d; all 78 focused tests and pre-commit 
pass. No escape correction is needed.



-- 
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]

Reply via email to