You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/09 22:32:07 UTC

[GitHub] [superset] ktmud commented on a change in pull request #12978: feat(dashboard): API to get a dashboard's charts

ktmud commented on a change in pull request #12978:
URL: https://github.com/apache/superset/pull/12978#discussion_r573294603



##########
File path: superset/dashboards/dao.py
##########
@@ -35,6 +36,14 @@ class DashboardDAO(BaseDAO):
     model_cls = Dashboard
     base_filter = DashboardFilter
 
+    @staticmethod
+    def get_charts_for_dashboard(dashboard_id: int) -> List[Slice]:
+        query = db.session.query(Dashboard).filter(Dashboard.id == dashboard_id)
+        dashboard = query.scalar()
+        if not dashboard:
+            raise DashboardNotFoundError()
+        return [slice.data for slice in dashboard.slices]

Review comment:
       If we defaults to marshmallow for object serialization, does that mean `x.data` will be eventually deprecated someday?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org