Skip to content

Import dashboard/assets with overwrite flag does not replace dashboards #22127

@cleslie

Description

@cleslie

When importing a dashboard via /api/v1/dashboard/import/ with the ovewrite flag set to true, the charts within the dashboard are merged with existing charts. I would expect if passing the overwrite flag that whatever you upload would replace the existing dashboard. This is useful for a version control where you want the .yml in the repository to exactly reflect what is in the superset database. This is also the same for the /api/v1/assets/import/ API although this doesn't take an overwrite parameter.

How to reproduce the bug

  1. Export dashboard with chartA and chartB
  2. Unzip exported file
  3. Edit yml to remove /charts/chartB.yml and remove references to it in /dashboards/dashboard.yml
  4. Zip up files and upload with overwrite flag
  5. Dashboard is updated but still contains both charts

Expected results

Expect that dashboards should be replaced when imported and the overwrite flag is passed.

Actual results

Imported dashboards seem to be merged with what is already in the database.

Screenshots

N/A

Environment

(please complete the following information):

  • browser type and version: firefox 106.0.5 but this is also the behaviour in the api
  • superset version: 2.0.1rc2
  • python version: 3.9.7
  • node.js version: 16.14.2
  • any feature flags active:

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Slack discussion: https://apache-superset.slack.com/archives/C015WAZL0KH/p1667918679617939

Metadata

Metadata

Assignees

No one assigned

    Labels

    #bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions