rusackas commented on code in PR #44169:
URL: https://github.com/apache/superset/pull/44169#discussion_r4018364951


##########
superset/commands/chart/create.py:
##########
@@ -81,7 +81,10 @@ def validate(self) -> None:
             # (SavedQuery/Query have no ``.name`` attribute, so accessing it
             # below raises an unhandled AttributeError) or silently, by
             # producing a permanently broken chart.
-            if datasource_type != DatasourceType.TABLE:
+            if datasource_type not in {
+                DatasourceType.TABLE,
+                DatasourceType.SEMANTIC_VIEW,
+            }:
                 raise DatasourceTypeInvalidError()
             datasource = get_datasource_by_id(datasource_id, datasource_type)

Review Comment:
   `Slice.datasource` now falls back to `self.semantic_view` when there is no 
table, so it does not come back `None` for a semantic-view chart anymore. That 
landed in a5d5b0b, resolving this.



##########
superset/commands/chart/update.py:
##########
@@ -236,7 +236,10 @@ def validate(self) -> None:  # noqa: C901
                 # below (SavedQuery/Query have no ``.name`` attribute, so
                 # accessing it raises an unhandled AttributeError) or
                 # silently.
-                if datasource_type != DatasourceType.TABLE:
+                if datasource_type not in {
+                    DatasourceType.TABLE,
+                    DatasourceType.SEMANTIC_VIEW,
+                }:
                     raise DatasourceTypeInvalidError()
                 if datasource_id is not None:
                     datasource = get_datasource_by_id(datasource_id, 
datasource_type)

Review Comment:
   Same fix covers this one. `Slice.datasource` falls back to 
`self.semantic_view` now, so it no longer returns `None` for a semantic-view 
chart (landed in a5d5b0b).



-- 
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]

Reply via email to