rusackas commented on code in PR #43500:
URL: https://github.com/apache/superset/pull/43500#discussion_r3850044779
##########
superset/commands/chart/update.py:
##########
@@ -223,6 +225,17 @@ def validate(self) -> None: # noqa: C901
# Validate/Populate datasource
if datasource_id is not None:
try:
+ # Slice.datasource only ever resolves the ``table``
+ # relationship (see Slice.datasource in
+ # superset/models/slice.py), so repointing a chart at any
+ # other datasource_type would "succeed" but leave the chart
+ # permanently unable to render. Reject those up front
+ # instead of failing later -- either at this lookup
+ # (SavedQuery/Query have no ``.name`` attribute, so
+ # accessing it below raises an unhandled AttributeError) or
+ # silently.
+ if datasource_type != DatasourceType.TABLE:
+ raise DatasourceTypeInvalidError()
Review Comment:
Good catch — fixed. The guard now only fires when `datasource_type` is
actually non-empty, so the missing-type case still surfaces
`DatasourceTypeUpdateRequiredValidationError` instead of getting overwritten.
--
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]