-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix: handle empty catalog when DB supports them #29840
Conversation
I just put this in draft mode whilst it doesn't have a title/description :) Best of luck with whatever it is! :D |
013d840
to
5e7d979
Compare
c03577f
to
9023b48
Compare
@@ -52,7 +52,7 @@ | |||
def fetch_files_github_api(url: str): # type: ignore | |||
"""Fetches data using GitHub API.""" | |||
req = Request(url) | |||
req.add_header("Authorization", f"token {GITHUB_TOKEN}") | |||
req.add_header("Authorization", f"Bearer {GITHUB_TOKEN}") |
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.
Note: In most cases, you can use Authorization: Bearer or Authorization: token to pass a token. However, if you are passing a JSON web token (JWT), you must use Authorization: Bearer. [source]
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.
Nice!
@supersetbot label 4.1 |
@@ -1159,7 +1159,7 @@ def select_star( | |||
self.incr_stats("init", self.select_star.__name__) | |||
try: | |||
result = database.select_star( | |||
Table(table_name, schema_name), | |||
Table(table_name, schema_name, database.get_default_catalog()), |
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.
Should catalog be added to the API path as well (when the table is not from the default one)? Not related with this PR, just asking if it's something we need to do.
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.
Yeah, but I I couldn't find any API calls to this endpoint — it seems like we return this in the database request now, instead of calling /select_star/
, which is why I didn't change the code to pass a parameter. I think we should keep this endpoint until the next major version and then get rid of it.
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.
gotcha! thank you
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.
LGTM!
@@ -1563,34 +1563,6 @@ def test_get_select_star_not_allowed(self): | |||
rv = self.client.get(uri) | |||
self.assertEqual(rv.status_code, 404) | |||
|
|||
def test_get_select_star_datasource_access(self): |
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.
Non-blocking comment: would be good if you could mention why these tests were removed.
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.
These tests were poorly written and relied on weird side effects.
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.
thank you!
(cherry picked from commit 39209c2)
SUMMARY
Handle edge cases when catalog is passed as
null
but the database supports catalog. This happens when "Allow changing catalogs" is disabled in the database. In these cases we need to use the default catalog, so that permissions checks work as expected.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
[Postgres].[superset]
)[Postgres].[superset].[public]
)ADDITIONAL INFORMATION