Skip to content

Commit c5b4837

Browse files
author
maxime.c
committed
mypy
1 parent f1cf1de commit c5b4837

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,13 +3480,15 @@ def create_state_delegating_stream(
34803480
f"state_delegating_stream, full_refresh_stream name and incremental_stream must have equal names. Instead has {model.name}, {model.full_refresh_stream.name} and {model.incremental_stream.name}."
34813481
)
34823482

3483-
stream_model = self._get_state_delegating_stream_model(has_parent_state, model)
3483+
stream_model = self._get_state_delegating_stream_model(
3484+
False if has_parent_state is None else has_parent_state, model
3485+
)
34843486

34853487
return self._create_component_from_model(stream_model, config=config, **kwargs) # type: ignore[no-any-return] # Will be created DeclarativeStream as stream_model is stream description
34863488

34873489
def _get_state_delegating_stream_model(
34883490
self, has_parent_state: bool, model: StateDelegatingStreamModel
3489-
):
3491+
) -> DeclarativeStreamModel:
34903492
return (
34913493
model.incremental_stream
34923494
if self._connector_state_manager.get_stream_state(model.name, None) or has_parent_state
@@ -3874,12 +3876,16 @@ def _instantiate_parent_stream_state_manager(
38743876
if not parent_state and not isinstance(parent_state, dict):
38753877
cursor_values = child_state.values()
38763878
if cursor_values:
3877-
incremental_sync_model = (
3878-
model.stream.incremental_sync
3879+
incremental_sync_model: Union[
3880+
DatetimeBasedCursorModel,
3881+
IncrementingCountCursorModel,
3882+
CustomIncrementalSyncModel,
3883+
] = (
3884+
model.stream.incremental_sync # type: ignore # if we are there, it is because there is incremental_dependency and therefore there is an incremental_sync on the parent stream
38793885
if isinstance(model.stream, DeclarativeStreamModel)
38803886
else self._get_state_delegating_stream_model(
38813887
has_parent_state, model.stream
3882-
)
3888+
).incremental_sync
38833889
)
38843890
cursor_field = InterpolatedString.create(
38853891
incremental_sync_model.cursor_field,

0 commit comments

Comments
 (0)