mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
fix: Allow "EXPLAIN" queries when "Allow DML" setting is False (#11348)
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
This commit is contained in:
@@ -111,7 +111,13 @@ class ParsedQuery:
|
||||
return self._parsed[0].get_type() == "SELECT"
|
||||
|
||||
def is_explain(self) -> bool:
|
||||
return self.stripped().upper().startswith("EXPLAIN")
|
||||
# Remove comments
|
||||
statements_without_comments = sqlparse.format(
|
||||
self.stripped(), strip_comments=True
|
||||
)
|
||||
|
||||
# Explain statements will only be the first statement
|
||||
return statements_without_comments.startswith("EXPLAIN")
|
||||
|
||||
def is_unknown(self) -> bool:
|
||||
return self._parsed[0].get_type() == "UNKNOWN"
|
||||
|
||||
Reference in New Issue
Block a user