superset-api-client icon indicating copy to clipboard operation
superset-api-client copied to clipboard

Add charts to dashboards

Open arieselinger opened this issue 4 years ago • 2 comments

Hi, I was wondering if there is a way to add charts to dashboard using the client. I manage to tweak json_metadata in order to change the dashboard layout but I am not able to associate any existing chart. I feel like the added value of the superset client would be to be able to create a complete dashboard from scratch in python. I am also a bit confused by the charts attribute: dashboard.charts returns a list of chart names (string), dashboard.get_charts returns a list of Ids (This is the list I would like to be able to update). Do you have any insight on this? Is any of this related to the following comment?

https://github.com/opus-42/superset-api-client/blob/26a583ab1dbe5360f1ab2fb518633bd707ebfe88/supersetapiclient/base.py#L175-L191

Thank you.

arieselinger avatar Apr 22 '22 13:04 arieselinger

Hello @arieselinger. I think the most recent version of Superset includes /dashboard/{id}/charts that could easily be used and integrated to the library. That would be a nice addition.

Let keep that issue open and see how to integrate that soon.

opus-42 avatar Aug 10 '22 21:08 opus-42

I found out how to do this in #38 which also adds fixes to make it work. See https://github.com/opus-42/superset-api-client/blob/534a1e4ca83c5ab48475e2c94fdd310de65fa7ea/tests/integration/test_basic.py#L424 for an example.

ecederstrand avatar Sep 15 '22 07:09 ecederstrand