Add SupersetService.import_dashboard for provisioning standard dashboards - #1426
Add SupersetService.import_dashboard for provisioning standard dashboards#1426roboton wants to merge 1 commit into
Conversation
…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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughChangesDashboard import
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Superseded by #1438 — same change, reopened from a fork branch per contribution workflow. |
Why
Part of the standardized-metrics work (design doc): orgs that enable the
dbt_taf_metricspackage should get the canned Survey Operations / Chat Engagement dashboards (DalgoT4D/dalgo-dashboard-templates) imported into their Superset automatically.SupersetServicealready has login/CSRF/retry plumbing but no import capability — this adds it.What
SupersetService.import_dashboard(bundle_zip, passwords=None, overwrite=True)— wrapsPOST /api/v1/dashboard/import/with the service's existing_make_request_with_retry, CSRF token, Referer, and session-cookie handling.overwrite=Truemakes re-provisioning idempotent.databases/*.yamlsqlalchemy_uri anddatasets/*.yamlschema to the org's warehouse before calling (reference implementation:scripts/import_dashboards.pyin dalgo-dashboard-templates);passwordsmaps database yaml paths to connection passwords since Superset never exports them.TestSupersetServicestyle; 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
Bug Fixes