-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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(SIP-95): new endpoint for extra table metadata #28063
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
51c565c
feat(sip-95): new endpoint for extra table metadata
betodealmeida 5da9c05
Improve extra_table_metadata deprecation
betodealmeida e3c1b64
Fix test
betodealmeida 48da875
Fix stats
betodealmeida 18bf8d6
Fix glob pattern
betodealmeida 0a622a6
s/table/name/g
betodealmeida File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import json | ||
import logging | ||
import re | ||
import warnings | ||
from datetime import datetime | ||
from re import Match, Pattern | ||
from typing import ( | ||
|
@@ -1034,21 +1035,33 @@ def normalize_indexes(cls, indexes: list[dict[str, Any]]) -> list[dict[str, Any] | |
return indexes | ||
|
||
@classmethod | ||
def extra_table_metadata( # pylint: disable=unused-argument | ||
def get_extra_table_metadata( # pylint: disable=unused-argument | ||
cls, | ||
database: Database, | ||
table_name: str, | ||
schema_name: str | None, | ||
table: Table, | ||
betodealmeida marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) -> dict[str, Any]: | ||
""" | ||
Returns engine-specific table metadata | ||
|
||
:param database: Database instance | ||
:param table_name: Table name | ||
:param schema_name: Schema name | ||
:param table: A Table instance | ||
:return: Engine-specific table metadata | ||
""" | ||
# TODO: Fix circular import caused by importing Database | ||
# old method that doesn't work with catalogs | ||
if hasattr(cls, "extra_table_metadata"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optional: if not hasattr(cls, "extra_table_metadata"):
return {}
... to reduce nesting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, I'll fix it in the next PR! |
||
warnings.warn( | ||
"The `extra_table_metadata` method is deprecated, please implement " | ||
"the `get_extra_table_metadata` method in the DB engine spec.", | ||
DeprecationWarning, | ||
) | ||
|
||
# If a catalog is passed, return nothing, since we don't know the exact | ||
# table that is being requested. | ||
if table.catalog: | ||
return {} | ||
|
||
return cls.extra_table_metadata(database, table.table, table.schema) | ||
|
||
return {} | ||
|
||
@classmethod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!