Skip to content

Comments

fix: optimize catalog permission sync when importing dashboards#33679

Merged
betodealmeida merged 2 commits intoapache:masterfrom
arafoperata:fix-catalog-permissions-sync
Jun 4, 2025
Merged

fix: optimize catalog permission sync when importing dashboards#33679
betodealmeida merged 2 commits intoapache:masterfrom
arafoperata:fix-catalog-permissions-sync

Conversation

@arafoperata
Copy link
Contributor

@arafoperata arafoperata commented Jun 4, 2025

SUMMARY

Following up from #33000. The previous PR fixed catalog permission syncing for databases like Postgres, which don't support multiple catalogs in one instance. However, permissions were still being synced for all the catalogs when creating a database connection (e.g. during a dashboard import).

This PR applies the same logic as the previous fix to CreateDatabaseCommand.

Fixes #32993.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

Added unit tests.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…queries, only sync permissions for the default catalog
@dosubot dosubot bot added the data:databases Related to database configurations and connections label Jun 4, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completed my review and didn't find any issues.

Files scanned
File Path Reviewed
superset/commands/database/utils.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@rusackas rusackas requested a review from betodealmeida June 4, 2025 03:38
@codecov
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.04%. Comparing base (76d897e) to head (45108b5).
⚠️ Report is 3194 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #33679       +/-   ##
===========================================
+ Coverage   60.48%   83.04%   +22.56%     
===========================================
  Files        1931      558     -1373     
  Lines       76236    40990    -35246     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    34042    -12072     
+ Misses      28017     6948    -21069     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 47.62% <0.00%> (-1.54%) ⬇️
javascript ?
mysql 73.96% <66.66%> (?)
postgres 74.01% <66.66%> (?)
presto 51.98% <0.00%> (-1.82%) ⬇️
python 83.04% <100.00%> (+19.54%) ⬆️
sqlite 73.49% <0.00%> (?)
unit 61.62% <100.00%> (+3.99%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for fixing this!

ssh_tunnel=ssh_tunnel,
)
else:
catalogs = {database.get_default_catalog()}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized we probably want to pass the ssh_tunnel to get_default_catalog, since for some DB engine specs we need to make a connection and run a query in order to figure out the default catalog (it can't be inferred from the SQLAlchemy URI). But we can do that in the future when we need it.

@betodealmeida betodealmeida merged commit ff34e3c into apache:master Jun 4, 2025
53 checks passed
ianngech pushed a commit to Pesapal-Ltd/superset that referenced this pull request Jun 10, 2025
LevisNgigi pushed a commit to LevisNgigi/superset that referenced this pull request Jun 18, 2025
@github-actions github-actions bot added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 6.0.0 First shipped in 6.0.0 labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels data:databases Related to database configurations and connections size/M 🚢 6.0.0 First shipped in 6.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catalog permission syncs severely degrades dashboard import performance

2 participants