Skip to content

Add SupersetService.import_dashboard for provisioning standard dashboards - #1426

Closed
roboton wants to merge 1 commit into
mainfrom
taf-import-dashboard
Closed

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

Conversation

@roboton

@roboton roboton commented Jul 12, 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 Superset dashboard bundles from ZIP files.
    • Supports dashboard overwrite options and password mappings during import.
  • Bug Fixes

    • Added automated coverage for successful imports and default import settings.

…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 12, 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

Run ID: a3d161fe-efa0-4bb3-89b7-34cd895f4d51

📥 Commits

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

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

Walkthrough

Changes

Dashboard import

Layer / File(s) Summary
Dashboard import request
ddpui/services/superset_service.py
Adds import_dashboard to authenticate with cached token and CSRF/session data, upload a ZIP bundle, serialize import options, and return Superset’s JSON response.
Import request validation
ddpui/tests/services/test_superset_service.py
Tests explicit passwords and default options, including multipart data, headers, cookies, and overwrite behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant SupersetService
  participant CachedAuthData
  participant SupersetAPI
  SupersetService->>CachedAuthData: obtain access token and CSRF/session data
  SupersetService->>SupersetAPI: POST dashboard bundle with headers, cookies, overwrite, and passwords
  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 summarizes the main change: adding SupersetService.import_dashboard to support dashboard provisioning.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taf-import-dashboard

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.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.72%. Comparing base (d53ccf4) to head (d33c57d).
⚠️ Report is 49 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1426      +/-   ##
==========================================
+ Coverage   60.71%   60.72%   +0.01%     
==========================================
  Files         150      150              
  Lines       17544    17550       +6     
==========================================
+ Hits        10652    10658       +6     
  Misses       6892     6892              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roboton

roboton commented Jul 24, 2026

Copy link
Copy Markdown
Author

Superseded by #1438 — same change, reopened from a fork branch per contribution workflow.

@roboton roboton closed this Jul 24, 2026
@roboton
roboton deleted the taf-import-dashboard branch July 24, 2026 18:30
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