Hi guys! Quick question. How can I move/copy dashb...
# gooddata-platform
a
Hi guys! Quick question. How can I move/copy dashboard from one workspace to another one?
y
Hi Akmal, Thanks for sending this in, happy to help. It is possible to migrate specific objects between workspaces via gray pages or Api calls. You can migrate metrics, attributes, facts, Reports and Dashboards as long as both workspaces share the same Logical Data Model (LDM). Kindly refer to our documentation Migrate selected objects for more guidance and details on this. Please note that migrating a report or dashboard that contains computed attributes, will cause the migration to fail with the following error:
Can't find %s with identifier %s
To migrate an object with computed attributes, see Use Computed Attributes. Let me know if this helps.
a
@Yvonne Changamuka Just to clarify, so it’s possible to transfer dashboard from one child to another, which shares same parent workspace?
j
Hi Akmal, I presume you are rather using GoodData Cloud product is that correct? Please note that you have raised your question in GoodData Platform channel instead so my colleague reply regarding Platform product. However, the situation and procedure is different for GoodData Cloud:
In GoodData Cloud, you can achieve this with a combination of REST API and Python SDK using the declarative layout. Below is a concise summary that combines both approaches. 1. Prerequisite: Same LDM in both workspaces (API) Both workspaces must share the same Logical Data Model (LDM) (same dataset/attribute/fact IDs). Otherwise, dashboard import will fail with validation errors. This should be okay in your case if we are talking about 2 Child workspaces with same Parent as they inherit the same LDM... You can “clone” the LDM from workspace A (
wsA
) to workspace B (
wsB
) via API: # Get LDM from wsA
Copy code
curl -H "Authorization: Bearer $API_TOKEN" \
  $HOST_URL/api/v1/layout/workspaces/wsA_id/logicalModel \
  > ldm.json
# Put LDM into wsB
Copy code
curl -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -X PUT \
  -d @ldm.json \
  $HOST_URL/api/v1/layout/workspaces/wsB_id/logicalModel
2. Option A – Move all analytics via API (analyticsModel) For an empty target workspace, you can copy the entire analytics model (all dashboards, insights, metrics, etc.): # Get analytics model from wsA
Copy code
curl -H "Authorization: Bearer $API_TOKEN" \
  $HOST_URL/api/v1/layout/workspaces/wsA_id/analyticsModel \
  > analytics.json
# Put analytics model into wsB
Copy code
curl -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -X PUT \
  -d @analytics.json \
  $HOST_URL/api/v1/layout/workspaces/wsB_id/analyticsModel
If
wsB
already has dashboards/metrics, you must edit
analytics.json
and include only the objects you want to move (e.g., selected
analyticalDashboards
,
visualizationObjects
,
metrics
, etc.), otherwise you risk overwriting or conflicting with existing content. Objects available under
analyticsModel
include: •
analyticalDashboards
visualizationObjects
metrics
filterContexts
dashboardPlugins
analyticalDashboardExtensions
attributeHierarchies
exportDefinitions
2. Option B – Copy a specific dashboard via Python SDK (file-based) If you want to copy just one dashboard (plus its definition) between workspaces, you can use the Python SDK to work with the declarative workspace layout
Copy code
from gooddata_sdk import GoodDataSdk
from pathlib import Path
import shutil

# SDK setup
sdk = GoodDataSdk.create(host="<https://your-gooddata-host.com>", token="your-token")

# Workspaces and dashboard
src_ws = "source_workspace_id"
dst_ws = "destination_workspace_id"
dashboard_id = "your_dashboard_id_to_clone"
root_path = Path("Test")

# Step 1: Store both workspaces locally
sdk.catalog_workspace.store_declarative_workspace(src_ws, layout_root_path=root_path)
sdk.catalog_workspace.store_declarative_workspace(dst_ws, layout_root_path=root_path)

# Dashboard YAML path pattern:
# Test/gooddata_layouts/<orgID>/workspaces/<workspaceID>/analytics_model/analytical_dashboards/<dashboardID>.yaml

# Step 2: Copy dashboard YAML from src to dst
src_path = root_path / "gooddata_layouts/<orgID>/workspaces" / src_ws / "analytics_model/analytical_dashboards"
dst_path = root_path / "gooddata_layouts/<orgID>/workspaces" / dst_ws / "analytics_model/analytical_dashboards"
shutil.copy(src_path / f"{dashboard_id}.yaml", dst_path / f"{dashboard_id}.yaml")

# Step 3: Push updated layout to destination workspace
sdk.catalog_workspace.load_and_put_declarative_workspace(dst_ws, layout_root_path=root_path)
This is a workaround, not a built‑in “clone dashboard” feature. • Both workspaces must have the *same LDM*; otherwise, you’ll get 400 errors about missing referenced entities (metrics, filterContexts, etc.). •
load_and_put_declarative_workspace
overwrites the entire declarative layout of the destination workspace, so test carefully and consider starting from a backup. When to use which • API only (analyticsModel): good when you want to move all analytics from one workspace to another (especially if the target is empty). • SDK + files: better when you want to move specific dashboards and are comfortable manipulating YAML files and then pushing the updated layout.
a
@Yvonne Changamuka @Julius Kos getting this error, do you know why?
y
Hello Akmal, It seems that the report payload references a filter context ID that doesn’t exist in that workspace, so the API rejects the request. Kindly verify if the filter context exists in the target workspace by listing the filter contexts in the workspace child_1_323 and confirm whether that ID is present. If it doesn’t exist, you can create a new filter context in that workspace, or remove the filterContexts reference from the request payload, or replace it with the correct filterContext ID from child_1_323. If doesn’t help, kindly share more detail on this e.g the workspace Ids, and the body of the payload being sent .
a
Got it Is there any method so I can check filters within a workspace?