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/05 22:59:42 UTC

[GitHub] [superset] betodealmeida opened a new pull request, #23599: feat(presto) `get_catalog_names`

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

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   I configured a Trino database and ran this script:
   
   ```python
   from superset.app import create_app
   
   app = create_app()
   with app.app_context():
       from superset import db
       from superset.db_engine_specs.presto import PrestoEngineSpec
       from superset.models.core import Database
   
       database = db.session.query(Database).first()
       with database.get_inspector_with_context() as inspector:
           print(PrestoEngineSpec.get_catalog_names(database, inspector))
   ```
   
   When ran, it produced the expected output:
   
   ```
   ['jmx', 'memory', 'mysql', 'system', 'tpcds', 'tpch']  
   ```
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### 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


[GitHub] [superset] codecov[bot] commented on pull request #23599: feat(presto): `get_catalog_names`

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

   ## [Codecov](https://codecov.io/gh/apache/superset/pull/23599?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#23599](https://codecov.io/gh/apache/superset/pull/23599?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (09471ad) into [master](https://codecov.io/gh/apache/superset/commit/56dcf25cf8ac5ed47235ebacde07200ccba257b3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (56dcf25) will **decrease** coverage by `11.34%`.
   > The diff coverage is `66.66%`.
   
   > :exclamation: Current head 09471ad differs from pull request most recent head 5e81c77. Consider uploading reports for the commit 5e81c77 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #23599       +/-   ##
   ===========================================
   - Coverage   67.72%   56.38%   -11.34%     
   ===========================================
     Files        1916     1916               
     Lines       74051    74054        +3     
     Branches     8040     8040               
   ===========================================
   - Hits        50153    41759     -8394     
   - Misses      21850    30247     +8397     
     Partials     2048     2048               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.68% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `58.97% <66.66%> (-23.45%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `52.65% <66.66%> (+<0.01%)` | :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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/23599?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/db\_engine\_specs/postgres.py](https://codecov.io/gh/apache/superset/pull/23599?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3Bvc3RncmVzLnB5) | `72.46% <ø> (-24.64%)` | :arrow_down: |
   | [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/23599?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `46.45% <66.66%> (-41.60%)` | :arrow_down: |
   
   ... and [300 files with indirect coverage changes](https://codecov.io/gh/apache/superset/pull/23599/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


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


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

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
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


[GitHub] [superset] betodealmeida merged pull request #23599: feat(presto): `get_catalog_names`

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


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


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

Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez commented on code in PR #23599:
URL: https://github.com/apache/superset/pull/23599#discussion_r1159926131


##########
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:
   Curious about why this had to change?



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