You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "arafoperata (via GitHub)" <gi...@apache.org> on 2025/06/04 02:42:05 UTC

[PR] fix: optimize catalog permission sync when importing dashboards [superset]

arafoperata opened a new pull request, #33679:
URL: https://github.com/apache/superset/pull/33679

   ### SUMMARY
   Following up from https://github.com/apache/superset/pull/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`.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A
   
   ### TESTING INSTRUCTIONS
   Added unit tests.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: optimize catalog permission sync when importing dashboards [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida merged PR #33679:
URL: https://github.com/apache/superset/pull/33679


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: optimize catalog permission sync when importing dashboards [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #33679:
URL: https://github.com/apache/superset/pull/33679#discussion_r2126953783


##########
superset/commands/database/utils.py:
##########
@@ -57,10 +57,21 @@ def add_permissions(database: Database, ssh_tunnel: SSHTunnel | None) -> None:
     """
     # TODO: Migrate this to use the non-commiting add_pvm helper instead
     if database.db_engine_spec.supports_catalog:
-        catalogs = database.get_all_catalog_names(
-            cache=False,
-            ssh_tunnel=ssh_tunnel,
-        )
+        # Adding permissions to all catalogs (and all their schemas) can take a long
+        # time (minutes, while importing a chart, eg). If the database does not
+        # support cross-catalog queries (like Postgres), and the multi-catalog
+        # feature is not enabled, then we only need to add permissions to the
+        # default catalog.
+        if (
+            database.db_engine_spec.supports_cross_catalog_queries
+            or database.allow_multi_catalog
+        ):
+            catalogs = database.get_all_catalog_names(
+                cache=False,
+                ssh_tunnel=ssh_tunnel,
+            )
+        else:
+            catalogs = {database.get_default_catalog()}

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: optimize catalog permission sync when importing dashboards [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #33679:
URL: https://github.com/apache/superset/pull/33679#issuecomment-2938312042

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/33679?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 65.99%. Comparing base [(`76d897e`)](https://app.codecov.io/gh/apache/superset/commit/76d897eaa2f9e137102bc194c2e3109c29d0348f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`2be031e`)](https://app.codecov.io/gh/apache/superset/commit/2be031ed26efcbee83ffbc0a7712879a39589f87?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 1925 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #33679      +/-   ##
   ==========================================
   + Coverage   60.48%   65.99%   +5.50%     
   ==========================================
     Files        1931      558    -1373     
     Lines       76236    40990   -35246     
     Branches     8568        0    -8568     
   ==========================================
   - Hits        46114    27052   -19062     
   + Misses      28017    13938   -14079     
   + Partials     2105        0    -2105     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/33679/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/33679/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.62% <0.00%> (-1.54%)` | :arrow_down: |
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/33679/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/33679/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `51.98% <0.00%> (-1.82%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/33679/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.99% <100.00%> (+2.49%)` | :arrow_up: |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/33679/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.62% <100.00%> (+3.99%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/33679?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org