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


##########
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:
   These patterns scan the whole raw message. If that's pyexasol's verbose 
`str()` with the `query =>` line, they match inside the user's SQL too: an 
`insufficient privileges` error on `SELECT 'syntax error' FROM P` came back as 
`SYNTAX_ERROR`, with `syntax error' FROM P` as the entire message.
   
   Might be misreading which string reaches here for `exa+websocket`, but a 
test with a multi-line pyexasol-shaped message would settle it either way.



##########
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:
   A quoted qualified name like `column "T"."C" not found` falls through to 
generic, since only one quoted part is allowed.
   
   If Exasol ever qualifies the name there, this keeps the one-identifier rule 
and still rejects `object COLUMN not found` (your 13 cases pass with it):
   
   ```suggestion
               r'(?: (?:"[^"\n]*"|[\w$]+)(?:\.(?:"[^"\n]*"|[\w$]+))*)? not 
found[^\n]*)',
   ```



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