Skip to content

Add SupersetService.import_dashboard for provisioning standard dashboards#1438

Open
roboton wants to merge 1 commit into
DalgoT4D:mainfrom
roboton:taf-import-dashboard
Open

Add SupersetService.import_dashboard for provisioning standard dashboards#1438
roboton wants to merge 1 commit into
DalgoT4D:mainfrom
roboton:taf-import-dashboard

Conversation

@roboton

@roboton roboton commented Jul 24, 2026

Copy link
Copy Markdown

Why

Part of the standardized-metrics work (design doc): orgs that enable the dbt_taf_metrics package should get the canned Survey Operations / Chat Engagement dashboards (DalgoT4D/dalgo-dashboard-templates) imported into their Superset automatically. SupersetService already has login/CSRF/retry plumbing but no import capability — this adds it.

What

  • SupersetService.import_dashboard(bundle_zip, passwords=None, overwrite=True) — wraps POST /api/v1/dashboard/import/ with the service's existing _make_request_with_retry, CSRF token, Referer, and session-cookie handling. overwrite=True makes re-provisioning idempotent.
  • The caller rewrites the bundle's databases/*.yaml sqlalchemy_uri and datasets/*.yaml schema to the org's warehouse before calling (reference implementation: scripts/import_dashboards.py in dalgo-dashboard-templates); passwords maps database yaml paths to connection passwords since Superset never exports them.
  • Two unit tests in the existing TestSupersetService style; all 10 pass.

Follow-up (separate PR)

The enablement flow (POST /api/dalgo_metrics/enable/: ensure package in org repo's packages.yml → write vars → dbt run → import bundles), per docs/ddp_backend_integration.md.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for importing dashboard bundles into Superset.
    • Dashboard imports can overwrite existing content and include password mappings.
  • Bug Fixes

    • Improved dashboard import requests with authentication, CSRF protection, and session handling.
  • Tests

    • Added coverage for successful imports, uploaded bundles, overwrite behavior, password handling, and default settings.

Supersedes #1426 (reopened from a fork per contribution workflow).

…ards

Wraps Superset's POST /api/v1/dashboard/import/ using the service's
existing token/CSRF/retry plumbing. First building block for
auto-provisioning the dbt_taf_metrics standard dashboards
(DalgoT4D/dalgo-dashboard-templates) per org.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0df51362-0702-41a4-99c1-a64ff3be2c55

📥 Commits

Reviewing files that changed from the base of the PR and between 82c019d and d33c57d.

📒 Files selected for processing (2)
  • ddpui/services/superset_service.py
  • ddpui/tests/services/test_superset_service.py

Walkthrough

SupersetService adds dashboard bundle import support using authenticated multipart requests, with CSRF/session handling and configurable overwrite/password fields. Unit tests cover configured values and defaults.

Changes

Superset dashboard import

Layer / File(s) Summary
Dashboard import request flow
ddpui/services/superset_service.py, ddpui/tests/services/test_superset_service.py
import_dashboard authenticates with Superset, uploads the zip bundle with JSON-encoded options, returns the response payload, and has tests for configured and default request values.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SupersetService
  participant SupersetAuth
  participant SupersetAPI
  SupersetService->>SupersetAuth: Get access token and CSRF/session credentials
  SupersetAuth-->>SupersetService: Return authentication values
  SupersetService->>SupersetAPI: POST multipart dashboard bundle and import options
  SupersetAPI-->>SupersetService: Return JSON response
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the new SupersetService.import_dashboard capability and matches the main change in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant