mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
chore: improve SQL parsing (#26767)
This commit is contained in:
@@ -295,3 +295,20 @@ class SupersetMarshmallowValidationError(SupersetErrorException):
|
||||
extra={"messages": exc.messages, "payload": payload},
|
||||
)
|
||||
super().__init__(error)
|
||||
|
||||
|
||||
class SupersetParseError(SupersetErrorException):
|
||||
"""
|
||||
Exception to be raised when we fail to parse SQL.
|
||||
"""
|
||||
|
||||
status = 422
|
||||
|
||||
def __init__(self, sql: str, engine: Optional[str] = None):
|
||||
error = SupersetError(
|
||||
message=_("The SQL is invalid and cannot be parsed."),
|
||||
error_type=SupersetErrorType.INVALID_SQL_ERROR,
|
||||
level=ErrorLevel.ERROR,
|
||||
extra={"sql": sql, "engine": engine},
|
||||
)
|
||||
super().__init__(error)
|
||||
|
||||
Reference in New Issue
Block a user