The cleanup_dashboard Module
Delete Superset dashboard(s) by title – AND the charts that belong to them –
via the REST API, so you don’t click through per-object DELETE confirmations
(console script: cleanup_dashboard).
HOW TARGETS ARE RESOLVED
Dashboards: matched by EXACT title (–title, and/or the title in –bundle).
Charts: resolved by MEMBERSHIP of the matched dashboards (queried from the API before the dashboards are deleted), NOT by name. This is deliberate: independent copies of a dashboard on different connections (e.g. DORIEH vs a DORIEH2 dev copy) share chart names like “Enrollments By Year”, so matching by name would miss or over-delete. Membership matches each copy’s own charts.
Datasets are NOT deleted by default (they represent DB tables/views and are typically shared). They are deleted only when named via –bundle, and you should scope them with –dataset-connection to avoid hitting another copy.
SAFETY
Dry-run by default: prints exactly what it WOULD delete and stops. Nothing is deleted unless you pass –execute.
Deletes in dependency-safe order: dashboards -> charts -> datasets.
Examples (dry run – always do this first):
cleanup_dashboard --title "Medicare Demo Quality Dashboard (DORIEH2 dev)"
cleanup_dashboard --title "…" --bundle path/to/bundle --dataset-connection DORIEH2
Then, once the printed list looks correct, append –execute.