mirror of
https://github.com/apache/superset.git
synced 2026-04-23 01:55:09 +00:00
fix(mcp): handle OAuth-authenticated databases in execute_sql (#39166)
This commit is contained in:
@@ -69,6 +69,8 @@ from flask import current_app as app, g, has_app_context
|
||||
from superset import db
|
||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||
from superset.exceptions import (
|
||||
OAuth2Error,
|
||||
OAuth2RedirectError,
|
||||
SupersetSecurityException,
|
||||
SupersetTimeoutException,
|
||||
)
|
||||
@@ -318,6 +320,10 @@ class SQLExecutor:
|
||||
)
|
||||
except SupersetSecurityException as ex:
|
||||
return self._create_error_result(QueryStatus.FAILED, str(ex), start_time)
|
||||
except (OAuth2RedirectError, OAuth2Error):
|
||||
# Let OAuth2 exceptions propagate so callers (MCP, API) can
|
||||
# handle them with context-appropriate responses.
|
||||
raise
|
||||
except Exception as ex:
|
||||
error_msg = self.database.db_engine_spec.extract_error_message(ex)
|
||||
return self._create_error_result(QueryStatus.FAILED, error_msg, start_time)
|
||||
|
||||
Reference in New Issue
Block a user