kokhlo commented on issue #44304:
URL: https://github.com/apache/superset/issues/44304#issuecomment-5679682875

   Verified on main — the full chain:
   
   1. `ImportModelsCommand._prevent_overwrite_existing_model()` 
(`superset/commands/importers/v1/__init__.py`) only compares `config["uuid"]` 
against existing UUIDs; slug is never consulted, so a fresh-UUID import with a 
colliding slug sails through validation.
   2. `import_dashboard()` inserts the row → unique constraint on 
`dashboards.slug` raises `IntegrityError` inside `_import()`.
   3. `ImportDashboardsCommand.run()` re-raises every non-`CommandException` as 
`DashboardImportError` — the hardcoded "Import dashboard failed for an unknown 
reason" (`superset/commands/dashboard/exceptions.py`). The modal then tells the 
user to re-export, which can't help.
   
   Plan: mirror what create/update already do — collect a slug-uniqueness 
`ValidationError` per dashboard config (naming the slug) whenever a non-empty 
slug is owned by a *different* dashboard (different uuid), so `validate()` 
fails fast with a `CommandInvalidError` carrying the real reason instead of the 
constraint blowing up mid-import. Same-uuid/same-slug under `overwrite` stays 
legal since it's the same dashboard. I'll add a regression test to the 
dashboard import suite.
   
   PR within the hour.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to