bito-code-review[bot] commented on PR #43119:
URL: https://github.com/apache/superset/pull/43119#issuecomment-5283043759

   <!-- Bito Reply -->
   The review suggestion is correct. Catching `SupersetGenericDBErrorException` 
broadly masks infrastructure issues (like connection or permission failures) as 
simple SQL validation errors. To resolve this, you should catch only the 
specific exception type related to SQL parsing or validation, allowing other 
database-level exceptions to propagate to the general error handler.
   
   If you have a specific validation exception class (e.g., 
`SupersetSQLValidationError`), replace the broad catch block with it. If not, 
you may need to inspect the exception message or error code within the `except` 
block to determine if it is truly a recoverable validation error before 
returning a successful tool response.
   
   **superset/mcp_service/dataset/tool/create_virtual_dataset.py**
   ```
   except SupersetSQLValidationError as exc:
           await ctx.warning(f"Virtual dataset SQL failed validation: {exc}")
           return CreateVirtualDatasetResponse(
               id=None,
               dataset_name=request.dataset_name,
               sql=request.sql,
               database_id=request.database_id,
               columns=[],
               url=None,
               error=f"Dataset SQL could not be executed: {exc}",
           )
   ```


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