Problem Description:
When importing a dashboard in Apache Superset and overwriting an old Dashboard, the system exhibits inconsistent behavior. I export a Dashboard from a Supersetinstance and import it to an other instance. Although the versions and configurations of the Superset instances are identical, the following issues occur after import:
- some charts are placed in the wrong tabs or outside the intended tabs.
- a random amount of Charts are duplicated: they appear both in the intended tab and outside, and deleting one of the duplicated charts removes both charts.
- an error message is displayed where the moved charts should be displayed: "There is no diagram definition associated with this component. Could it have been deleted? Delete this container and save to remove this message."
Steps to Reproduce:
- export a dashboard from Superset Instance 1 using the export function
- import the entire export folder (including YAML files) to Superset Instance 2, overwriting the existing dashboard
- observe that charts are misplaced or duplicated
Expected Behavior:
- the imported dashboard should appear identical on Instance 2 as it does on Instance 1.
Actual Behavior:
- charts are not in their intended position and are partially duplicated.
Environment:
Superset Version: 4.0.2 with internal Postgres database version 15 Execution Environment: Docker Container Connected Databases: PostGIS database version 17-3.5-alpine
Workaround:
- the issue does not occur if all existing dashboards, datasets and charts in the Supersetinstance are deleted before importing
Priority:
- due to the existing workaround, the priority is not high, but resolving the issue would make the import process more efficient.
Additional Information:
- no related issues or documentation could be found that explain this behavior. Currently, the only known solution is to clean the instance before importing.
Comment From: dosubot[bot]
Hey @hansabusch! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's get to the bottom of this together!
To address the issue of charts being misplaced or duplicated when importing a dashboard in Apache Superset, ensure that the import_dashboard
function correctly updates the position_json
and json_metadata
fields to map old slice IDs to new ones. This is crucial for maintaining the correct layout and associations of charts within the dashboard.
The import_dashboard
function includes a helper function alter_positions
that updates the chartId
in the position_json
to reflect the new slice IDs. Similarly, alter_native_filters
updates the datasetId
in the json_metadata
for native filters. These updates are necessary to prevent misplacement or duplication of charts.
Additionally, ensure that the position
and native_filter_configuration
are correctly fixed during the import process. The position
should be updated to map the chartId
using the chart_ids
dictionary, and the native_filter_configuration
should update datasetId
using dataset_info
. Also, ensure that any scope
exclusions are updated using the id_map
. These steps are crucial for maintaining the integrity of the dashboard layout and filter configurations [1][2][3].
I found two similar unsolved discussions that might be relevant: 1. Exporting and Importing complete Dashboards [4]. 2. Import dashboard with overwriting all related objects (charts and datasets) [5].
These discussions might provide additional insights or potential solutions to your issue.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
Comment From: rusackas
Interesting... I haven't seen this one happen. Wonder if @Vitor-Avila or @sadpandajoe have heard of anything here.
Out of curiosity, if you Export from Superset A, to replace the dashboard on Superset B, were charts moved around between tabs on Superset B prior to importing from Superset A?
I'm just wondering if it's something like Superset A has a Chart on Tab 1 (as part of the export). Then, maybe, Superset B moved the Chart to Tab 2. Then upon overwriting, the Chart is on Tab 1 AND 2? Seems unlikely, but I'm just trying to find a reproducible scenario here.
Comment From: Vitor-Avila
not familiar with it as well 🤔