Skip to content
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

refactor(ingestion/tableau): mark the fetch_size configuration as deprecated. #12126

Merged
merged 7 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ class TableauConfig(

fetch_size: int = Field(
default=250,
description="Specifies the number of records to retrieve in each batch during a query execution.",
description="[deprecated] Use page_size instead. Specifies the number of records to retrieve in each batch during a query execution.",
sid-acryl marked this conversation as resolved.
Show resolved Hide resolved
hidden_from_docs=True,
)

# We've found that even with a small workbook page size (e.g. 10), the Tableau API often
Expand Down Expand Up @@ -497,6 +498,11 @@ class TableauConfig(
"This can only be used with ingest_tags enabled as it will overwrite tags entered from the UI.",
)

_fetch_size = pydantic_field_deprecated(
"fetch_size",
message="fetch_size is deprecated, use page_size instead",
)

# pre = True because we want to take some decision before pydantic initialize the configuration to default values
@root_validator(pre=True)
def projects_backward_compatibility(cls, values: Dict) -> Dict:
Expand Down Expand Up @@ -1108,7 +1114,7 @@ def get_connection_object_page(
connection_type: str,
query_filter: str,
current_cursor: Optional[str],
fetch_size: int = 250,
fetch_size: int,
retry_on_auth_error: bool = True,
retries_remaining: Optional[int] = None,
) -> Tuple[dict, Optional[str], int]:
Expand Down Expand Up @@ -1306,7 +1312,11 @@ def get_connection_objects(
connection_type=connection_type,
query_filter=filter_,
current_cursor=current_cursor,
fetch_size=self.config.fetch_size,
# `filter_page` contains metadata object IDs (e.g., Project IDs, Field IDs, Sheet IDs, etc.).
# The number of IDs is always less than or equal to page_size.
# If the IDs are primary keys, the number of metadata objects to load matches the number of records to return.
# In our case, mostly, the IDs are primary key, therefore, fetch_size is set equal to page_size.
fetch_size=page_size,
)

yield from connection_objects.get(c.NODES) or []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,7 @@ def test_permission_mode_switched_error(pytestconfig, tmp_path, mock_datahub_gra
query_filter=mock.MagicMock(),
current_cursor=None,
retries_remaining=1,
fetch_size=10,
)

warnings = list(reporter.warnings)
Expand Down
Loading