Abdulrehman-PIAIC80387 commented on code in PR #42463:
URL: https://github.com/apache/superset/pull/42463#discussion_r3680738666
##########
superset/connectors/sqla/utils.py:
##########
@@ -109,13 +110,13 @@ def get_virtual_table_metadata(dataset: SqlaTable) ->
list[ResultSetColumnType]:
dataset.sql, **dataset.template_params_dict
)
except SupersetSyntaxErrorException as ex:
- raise SupersetGenericDBErrorException(
+ raise SupersetVirtualTableParseException(
message=_("Template processing error: %(error)s", error=str(ex)),
) from ex
Review Comment:
Fixed in `a5d642b`. Confirmed the path — `process_template` in
`jinja_context.py:807-848` wraps `SecurityError` (along with
`TemplateSyntaxError`, `UndefinedError`, and `Unicode*Error`) into
`SupersetSyntaxErrorException`.
Now inspecting `ex.__cause__` at the catch and only raising the soften-able
`SupersetVirtualTableParseException` when the underlying cause is
`jinja2.UndefinedError` (missing runtime variable). `SecurityError`,
`TemplateSyntaxError`, and encoding errors keep raising the base
`SupersetGenericDBErrorException` so sandbox and template-policy failures
surface to the operator.
New regression test
`test_get_virtual_table_metadata_template_security_error_is_not_softened` locks
this in.
--
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]