Hey everyone, I have two data sources with an ide...
# gd-beginners
m
Hey everyone, I have two data sources with an identical set of tables. I have a dashboard built on data source 1. I want to change the dashboard’s data source to be data source 2. Is this possible without having to recreate everything in the dashboard?
m
Hi Michael, currently you will probably need two workspaces for this - as far as I know, multiple datasources per workspace are not yet supported. If you decide to go with two workspaces, you can either keep them independent - create new empty workspace and use the declarative API to get the original workspace structure, modify the referenced datasource and use another declarative API call to put the modified workspace definition to the new workspace. Or, you could utilize the Workspace Hierarchy to set the other workspace as a child of the original one. That way it will dynamically inherit whole its model, dashboards, metrics, insights etc. and any change you make to the parent workspace gets immediatelly propagated to the child. To separate the data sources, you can use this feature to override the data source per tenant.
🙌 1
m
Awesome, thanks for this super helpful response. I’ll probably go with your first suggestion 👍
m
If you preferred Python code to calling raw APIs, you might also take a look at the Python SDK: Specifically this clone method and its “*data_source_mapping*” parameter seems it might work for your case. (I do not have personal experience using it).
m
Niceeee that was actually my true plan haha, I just finished skimming through the docs. Thanks for pointing me to that method
👌 1
m
Great, happy to help 🙂 BTW back to the solution architecture and which way to do it - it might also depend on your plans if you allow your end users to modify the workspace or not. If you only plan to have view permissions for your end users (and manage all the visualizations and dashboards there by some group of admins), this approach will just work fine. But if you plan to give the end users also rights to create their own visualizations and dashboards, if you keep your workspaces independent, it might become somehow more difficult if you later want to release some newer core version to both these workspaces (i.e. add some new standard dashboards & metrics) without removing the end user customizations. Nothing that could not be done, I guess, but just wanted to give you this broader view.
👍 1