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

[GitHub] [superset] betodealmeida commented on a diff in pull request #23599: feat(presto): `get_catalog_names`

betodealmeida commented on code in PR #23599:
URL: https://github.com/apache/superset/pull/23599#discussion_r1160019092


##########
superset/db_engine_specs/postgres.py:
##########
@@ -310,7 +310,7 @@ def get_catalog_names(
 SELECT datname FROM pg_database
 WHERE datistemplate = false;
             """
-            ).fetchall()

Review Comment:
   @Antonio-RiveroMartnez in this case it's redundant, the expression generator will implicitly call `fetchall()` here. Eg:
   
   ```python
   >>> from sqlalchemy import create_engine
   >>> engine = create_engine("shillelagh://")
   >>> url = "https://docs.google.com/spreadsheets/d/1LcWZMsdCl92g7nA-D6qGRqg1T5TiHyuKJUY1u9XAnsk/edit#gid=0"
   >>> engine.execute(f'SELECT * FROM "{url}"').fetchall()
   [('BR', 2), ('BR', 4), ('ZA', 7), ('CR', 11), ('CR', 11), ('FR', 100), ('AR', 42)]
   >>> [row for row in engine.execute(f'SELECT * FROM "{url}"')]
   [('BR', 2), ('BR', 4), ('ZA', 7), ('CR', 11), ('CR', 11), ('FR', 100), ('AR', 42)]
   ```



-- 
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