-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(presto): get_catalog_names
#23599
Conversation
get_catalog_names
get_catalog_names
739445f
to
5e81c77
Compare
Codecov Report
@@ Coverage Diff @@
## master #23599 +/- ##
==========================================
- Coverage 67.72% 67.72% -0.01%
==========================================
Files 1916 1916
Lines 74051 74054 +3
Branches 8040 8040
==========================================
+ Hits 50153 50155 +2
- Misses 21850 21851 +1
Partials 2048 2048
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
5e81c77
to
e5402fb
Compare
e5402fb
to
0105645
Compare
@@ -310,7 +310,7 @@ def get_catalog_names( | |||
SELECT datname FROM pg_database | |||
WHERE datistemplate = false; | |||
""" | |||
).fetchall() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious about why this had to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Antonio-RiveroMartnez in this case it's redundant, the expression generator will implicitly call fetchall()
here. Eg:
>>> 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)]
SUMMARY
Implement
get_catalog_names
for Presto/Trino. This is needed to support catalog-level permissions, and also for #22862.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
I configured a Trino database and ran this script:
When ran, it produced the expected output:
ADDITIONAL INFORMATION