question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dashboard slug is cleared on import

See original GitHub issue

Import a dashboard using superset import-dashboards cmd

Expected results

dashboard is imported as yaml file described

Actual results

dashboard is imported but slug is cleared

Environment

(please complete the following information):

  • superset version: 0.37
  • python version: Python 3.8.5
  • node.js version: v12.4.0
  • npm version: 6.14.7

Checklist

Make sure these boxes are checked 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

The slug is cleared on purpose, which is to avoid conflict, see https://github.com/apache/incubator-superset/blob/master/superset/models/dashboard.py#L316. But that behavior is not expected in some cases. If a dashboard is exported to a yaml and imported later, I would expect the same dashboard gets overwritten rather than creating a new dashboard with an empty slug. This is very useful when I want to create/update dashboard automatically without manual intervene. If user wants to avoid conflict, user can manually edit dashboard yaml file and set slug to null instead of hard clear in superset code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stuarthucommented, Jul 31, 2020

@villebro The slug is cleared on purpose, which is to avoid conflict, see https://github.com/apache/incubator-superset/blob/master/superset/models/dashboard.py#L316. But that behavior is not expected in some cases. If a dashboard is exported to a yaml and imported later, I would expect the same dashboard gets overwritten rather than creating a new dashboard with an empty slug. This is very useful when I want to create/update dashboard automatically without manual intervene. If user wants to avoid conflict, user can manually edit dashboard yaml file and set slug to null instead of hard clear in superset code. I use a script to create the dashboard.yaml and import into superset. Without the slug, I don’t know how to reference the created dashboard in superset db.

0reactions
andy-clapsoncommented, Sep 20, 2022

I am having the same problem as @stuarthu. I need to automate dashboard imports but it seems impossible to do this in a consistent way due to this slug clearing.

Anyone knows a way to solve this?

the best solution I’ve foubdn so far (as of version 1.5.1) is to have an import script that roughyl does the following:

  • finds target dashboard(s) to import, named by slug
  • deletes any existing dashboards with that slug
  • import the target dashboards
  • then send a PUT to set the slug values on each
Read more comments on GitHub >

github_iconTop Results From Across the Web

dashboard slug is cleared on import · Issue #10479
Import a dashboard using superset import-dashboards cmd. Expected results. dashboard is imported as yaml file described. Actual results.
Read more >
Swap dashboards without affecting url
Cat dashboard to file and then import it with force on (has to have the same title or name, can't remember which).
Read more >
ErrorException Trying to get property 'slug' of non-object
but what I want, when I'm on the edit page and I click the dashboard menu, the display should be dashboard view, not...
Read more >
What is an account slug?
The slug is just the first part of the URL where your dashboard and knowledge base are hosted. You choose your account slug...
Read more >
How to list, create, update and delete Grafana dashboards ...
How to list, create, update and delete Grafana dashboards via API ... import requests import json server = "https://<your_server>/grafana" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found