mikebridge commented on code in PR #45287:
URL: https://github.com/apache/superset/pull/45287#discussion_r4289624381
##########
superset/commands/semantic_layer/create.py:
##########
@@ -108,7 +111,41 @@ def validate(self) -> None:
raise SemanticViewForbiddenError()
name: str = self._properties.get("name", "")
- configuration: dict[str, Any] = self._properties.get("configuration")
or {}
+ raw_configuration: dict[str, Any] | str = (
+ self._properties.get("configuration") or {}
+ )
+ try:
+ configuration: Any = (
+ json.loads(raw_configuration)
+ if isinstance(raw_configuration, str)
+ else raw_configuration
+ )
+ except ValueError:
+ configuration = None
+ if not isinstance(configuration, dict):
+ raise SemanticViewInvalidError(
+ _("The view configuration must be a JSON object.")
+ )
+ try:
+ view: SemanticViewABC | None =
layer.implementation.get_semantic_view(
+ name, configuration
+ )
+ except Exception as ex: # pylint: disable=broad-except
+ logger.warning(
+ "Semantic view lookup failed for layer %s, view %s: %s",
+ layer_uuid,
+ name,
+ type(ex).__name__,
+ )
+ view = None
+ if view is None:
Review Comment:
Added in 5842d575b3: the no-view rejection logs an INFO message with the
layer UUID and view name, including when the provider returns None. The
exception path keeps its type-only warning and also emits that INFO message.
The red-first test_create_semantic_view_lookup_failure[None] pins the exact
INFO message and level; the exception cases pin both messages and still check
that provider exception text and tracebacks are absent. No request or
persistence behavior changed.
--
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]