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 5 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 @@ -49,6 +49,7 @@
DatasetSourceConfigMixin,
)
from datahub.configuration.validate_field_deprecation import pydantic_field_deprecated
from datahub.configuration.validate_field_removal import pydantic_removed_field
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.emitter.mcp_builder import (
ContainerKey,
Expand Down Expand Up @@ -382,7 +383,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="[removed] The 'fetch_size' field is no longer used. Please use 'page_size' instead.",
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 @@ -499,6 +501,10 @@ class TableauConfig(
"This can only be used with ingest_tags enabled as it will overwrite tags entered from the UI.",
)

_fetch_size = pydantic_removed_field(
"fetch_size",
)

# 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 @@ -1148,7 +1154,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 @@ -1345,7 +1351,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 @@ -1324,6 +1324,7 @@ def test_permission_warning(pytestconfig, tmp_path, mock_datahub_graph):
query_filter=mock.MagicMock(),
current_cursor=None,
retries_remaining=1,
fetch_size=10,
)

warnings = list(reporter.warnings)
Expand Down
Loading