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-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org