Skip to content

Commit c14f963

Browse files
refactor: Move incremental_sync check to _get_state_delegating_stream_model
Addresses review comment from tolik0 - the incremental_sync check is now performed in the calling method before invoking _is_cursor_older_than_retention_period. Co-Authored-By: unknown <>
1 parent dceb70d commit c14f963

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,8 +3575,9 @@ def _get_state_delegating_stream_model(
35753575
return model.full_refresh_stream
35763576

35773577
if model.api_retention_period and stream_state:
3578-
if self._is_cursor_older_than_retention_period(
3579-
stream_state, model.incremental_stream, model.api_retention_period, model.name
3578+
incremental_sync = model.incremental_stream.incremental_sync
3579+
if incremental_sync and self._is_cursor_older_than_retention_period(
3580+
stream_state, incremental_sync, model.api_retention_period, model.name
35803581
):
35813582
return model.full_refresh_stream
35823583

@@ -3585,7 +3586,7 @@ def _get_state_delegating_stream_model(
35853586
def _is_cursor_older_than_retention_period(
35863587
self,
35873588
stream_state: Mapping[str, Any],
3588-
incremental_stream: DeclarativeStreamModel,
3589+
incremental_sync: Any,
35893590
api_retention_period: str,
35903591
stream_name: str,
35913592
) -> bool:
@@ -3597,10 +3598,6 @@ def _is_cursor_older_than_retention_period(
35973598
Returns True if the cursor is older than the retention period (should use full refresh).
35983599
Returns False if the cursor is within the retention period (safe to use incremental).
35993600
"""
3600-
incremental_sync = incremental_stream.incremental_sync
3601-
if not incremental_sync:
3602-
return False
3603-
36043601
cursor_field = getattr(incremental_sync, "cursor_field", None)
36053602
if not cursor_field:
36063603
return False

0 commit comments

Comments
 (0)