Hi folks- is there any way to copy complete dashbo...
# gooddata-cloud
a
Hi folks- is there any way to copy complete dashboard from one environment to another.
k
There is no single “copy dashboard” button between environments, but it is possible using APIs / declarative layouts; the exact method depends on how much you want to move. From the shared materials: • You can move entire workspace content (LDM + all visualizations + dashboards) between environments using the workspace/organization declarative APIs or by cloning a workspace (optionally via Python SDK).[Clone workspace; Org backups] • It is also possible to migrate dashboards and other analytical objects between workspaces by working with the
analyticsModel
layout (dashboards, visualizations, metrics, etc.) and PUT‑ing selected parts into the target workspace, provided the LDM is compatible. This is described as a “workaround” but confirmed to work.[Migrate objects; Export LDM/viz] However, the knowledge sources do not provide a step‑by‑step, dashboard‑only, cross‑environment recipe (e.g., “export dashboard X from env A and import it into env B”)—only that: • You can move whole workspaces (which includes all dashboards).[Clone workspace] • You can manipulate the analytics model JSON to move selected objects between workspaces if you are careful with dependencies and matching LDMs.[Migrate objects] So: yes, it’s possible via API/declarative layouts, but the docs here don’t give a simple, dashboard‑only cross‑environment procedure. If you tell me whether you can move a whole workspace or must move just specific dashboards, I can outline the high‑level approach based on these references. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups. 👀 Our Support team monitors all messages and will jump in if needed.
a
i want to move specific dashboard from one to another, without building widgets
m
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. 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
in the target workspace do we have to first create the visualization?
m
You don’t need to pre-create visualizations in the target workspace if you migrate the dashboard along with its dependent objects (insights/visualizations, metrics, filter contexts). If you copy only the dashboard definition, then you do need to also move the referenced visualisation objects (otherwise the import will fail due to missing references).
s
Hey Anjali. We’re just wondering if you've had a chance to review the latest update from us regarding your support request? We've provided an update some time ago but we haven't heard back from you.