Duplicate a Superset dashboard, then replace its dataset source at once?
Asked Answered
P

3

5

I am using Superset for data visualisation and I'm used to upload a csv file for each dataset I need. My issue is when I want to duplicate a dashboard and replace the datasource only for the copied dashboard. In practice I export the dashboard that I want to copy, then import it, and change the dataset for each graph of the dashboard. This task can be quite time-consuming and I would like to know if there is any way to change the dataset source in the duplicated dashboard for all its graphs at once?

Poree answered 14/9, 2021 at 14:26 Comment(0)
D
1

Dashboards are exported as a zipped archive of yaml files. You could use a text editor to find-and-replace the dataset id in the exported files before importing.

Drobman answered 14/9, 2021 at 18:3 Comment(2)
But you also have to generate new uuids for these charts so they become unique. How to do it?Wheezy
use the uuid generator of your choice, there are loads of options there. Then copy/paste. Could definitely be scripted, something like "download, unzip, parse yaml, for each uuid generate&replace, write yaml". I don't know of any publicly available scripts specifically for this though.Drobman
P
5

You can also just open the existing Dashboard and then Save As. This provides an option to also duplicate the underlying Charts (or not). See: https://github.com/apache/superset/issues/4963

Partisan answered 21/4, 2022 at 19:59 Comment(1)
They are not duplicated, just copiedWheezy
B
2

Suddjian's answer about replacing uuids is on the right track, but charts have a "datasource" parameter that is unique to the underlying dataset. This "datasource" parameter doesn't seem to be part of the exported dataset metadata. It is assigned when the dataset is created, though it can be modified (thru the UI, at least).

Bellda answered 26/2, 2023 at 20:58 Comment(3)
@JamesRisner removed the question from my post, but while I don't have a full answer, my comment aims to shed light on a murky issueBellda
I noticed. I edited also to remove more parts and leave only the answer parts.Ante
You could put that question you had at the end on the OP's question or as a comment on this answer.Ante
D
1

Dashboards are exported as a zipped archive of yaml files. You could use a text editor to find-and-replace the dataset id in the exported files before importing.

Drobman answered 14/9, 2021 at 18:3 Comment(2)
But you also have to generate new uuids for these charts so they become unique. How to do it?Wheezy
use the uuid generator of your choice, there are loads of options there. Then copy/paste. Could definitely be scripted, something like "download, unzip, parse yaml, for each uuid generate&replace, write yaml". I don't know of any publicly available scripts specifically for this though.Drobman

© 2022 - 2024 — McMap. All rights reserved.