Skip to main content

superset-promote-dashboard

A Superset plugin that lets you swap all chart datasources in a dashboard from one database connection to another in one click — useful for promoting dashboards between environments (dev → staging → prod).

How it works

  1. Pick a dashboard and a target database connection
  2. Preview — see which charts will be swapped, which have no match, and which are already on the target
  3. Promote — each chart is updated to the matching dataset in the target DB, matched by table name

Charts are matched by table_name (and schema when set). Virtual datasets (SQL-based) are skipped.

Installation

pip install superset-promote-dashboard

Register the plugin in your superset_config.py:

def init_promote_plugin(app):
    try:
        from superset_promote_dashboard.promote_view import PromoteDashboardView
        import os, superset_promote_dashboard
        from jinja2 import ChoiceLoader, FileSystemLoader

        app.appbuilder.add_view(
            PromoteDashboardView,
            "Promote Dashboard",
            icon="fa-arrow-circle-up",
            category="Custom Tools",
            category_icon="fa-wrench",
        )

        sm = app.appbuilder.sm
        admin_role = sm.find_role("Admin")
        if admin_role:
            grants = [
                ("menu_access", "Promote Dashboard"),
                ("menu_access", "Custom Tools"),
                ("can_index",       "PromoteDashboardView"),
                ("can_api_preview", "PromoteDashboardView"),
                ("can_api_promote", "PromoteDashboardView"),
            ]
            for action, view_name in grants:
                pvm = sm.add_permission_view_menu(action, view_name)
                if pvm:
                    sm.add_permission_role(admin_role, pvm)

        pkg_templates = os.path.join(os.path.dirname(superset_promote_dashboard.__file__), "templates")
        if os.path.exists(pkg_templates):
            from jinja2 import ChoiceLoader, FileSystemLoader
            app.jinja_env.loader = ChoiceLoader([app.jinja_env.loader, FileSystemLoader(pkg_templates)])
    except Exception as e:
        import logging
        logging.getLogger(__name__).error(f"Failed to register promote-dashboard plugin: {e}")

FLASK_APP_MUTATOR = init_promote_plugin

Restart Superset — Custom Tools → Promote Dashboard will appear in the navigation.

Local development

Requires Docker.

docker compose up

This starts:

  • postgres — one container serving three databases: superset, db_source, db_target
  • superset — Apache Superset 4.1.1 with the plugin installed, at http://localhost:8088
  • superset-init — one-shot container that runs migrations, creates the admin user, seeds database connections, datasets, and the "Academic Overview" demo dashboard

Login: admin / admin

Demo data

The test environment uses a high-school theme to make the source vs. target difference obvious:

Database Contents
Source DB 2023-2024 school year — 20 students, 50 grade records (Q1-Q4), 36 attendance records
Target DB 2024-2025 cohort — 6 students, 15 grade records (Q1-Q3 in progress), 10 attendance records

Tables in both databases: students, grades, attendance.

Promoting the demo dashboard

  1. Navigate to Custom Tools → Promote Dashboard
  2. Select Academic Overview and Target DB
  3. Click Preview — all 5 charts should show "Will swap"
  4. Click Promote — charts are updated; reload the dashboard to see the new cohort's data
  5. Run Preview again — all charts now show "Already on target"

Security

  • All routes are protected by @has_access — unauthenticated requests redirect to login
  • CSRF is fully enabled; the plugin generates a CSRF token via generate_csrf() and forwards it in both the browser meta tag and all server-side PUT calls to the Superset API
  • Admin role permissions are granted automatically on startup; other roles can be granted access through Security → List Roles in the Superset UI

Requirements

  • Apache Superset 4.x
  • Python 3.10+
  • flask-wtf (included with Superset)

Metadata

Release files for superset-promote-dashboard 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for superset-promote-dashboard 0.1.1
File Size Uploaded
superset_promote_dashboard-0.1.1.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for superset-promote-dashboard 0.1.1
File Interpreter ABI Platform
superset_promote_dashboard-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / superset_promote_dashboard-0.1.1.tar.gz

Download URL superset_promote_dashboard-0.1.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1c4b9a8daccf9456fc4c1090a34a177aba324e8cb2d81d49921f0a36e7ccc4a9
BLAKE2b-256 checksum
How to use checksums
cb5dfac5bf49645574f3d2148d446ae5be5d241d9e84b40b0c8425944f8842ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1020-azure

Release files / superset_promote_dashboard-0.1.1-py3-none-any.whl

Download URL superset_promote_dashboard-0.1.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ba61d61d8547eb210ab842ec10fae13bb33cce0258e889f2c9a35d851087845
BLAKE2b-256 checksum
How to use checksums
c43d32994bc0be399fcca0319393aa522d67d9c276842fbc64ccba48cc2da334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1020-azure

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page