fix: User-provided Jinja template parameters causing SQL parsing errors (#34802)

(cherry picked from commit e1234b2264)
This commit is contained in:
Michael S. Molina
2025-08-22 14:39:14 -03:00
committed by Michael S. Molina
parent 878289a2e6
commit aa69ce43d9
10 changed files with 75 additions and 39 deletions

View File

@@ -56,7 +56,7 @@ from superset.models.helpers import (
ExtraJSONMixin,
ImportExportMixin,
)
from superset.sql_parse import CtasMethod, extract_tables_from_jinja_sql, Table
from superset.sql_parse import CtasMethod, process_jinja_sql, Table
from superset.sqllab.limiting_factor import LimitingFactor
from superset.utils import json
from superset.utils.core import (
@@ -80,10 +80,10 @@ class SqlTablesMixin: # pylint: disable=too-few-public-methods
def sql_tables(self) -> list[Table]:
try:
return list(
extract_tables_from_jinja_sql(
process_jinja_sql(
self.sql, # type: ignore
self.database, # type: ignore
)
).tables
)
except (SupersetSecurityException, SupersetParseError, TemplateError):
return []