Skip to content

Commit e6f9485

Browse files
committed
pr feedback
1 parent 072b739 commit e6f9485

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

airbyte_cdk/sources/declarative/retrievers/simple_retriever.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,12 @@ def stream_slices(self) -> Iterable[Optional[StreamSlice]]: # type: ignore
569569
"""
570570
return self.stream_slicer.stream_slices()
571571

572+
# todo: There are a number of things that can be cleaned up when we remove self.cursor and all the related
573+
# SimpleRetriever state management that is handled by the concurrent CDK Framework:
574+
# - ModelToComponentFactory.create_datetime_based_cursor() should be removed since it does need to be instantiated
575+
# - ModelToComponentFactory.create_incrementing_count_cursor() should be removed since it's a placeholder
576+
# - test_simple_retriever.py: Remove all imports and usages of legacy cursor components
577+
# - test_model_to_component_factory.py:test_datetime_based_cursor() test can be removed
572578
@property
573579
def state(self) -> Mapping[str, Any]:
574580
return self.cursor.get_stream_state() if self.cursor else {}

unit_tests/connector_builder/test_connector_builder_handler.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import json
88
import logging
99
import os
10-
from typing import List, Literal, Union
10+
from typing import List, Literal
1111
from unittest import mock
1212
from unittest.mock import MagicMock, patch
1313

@@ -32,7 +32,6 @@
3232
StreamReadPages,
3333
StreamReadSlices,
3434
)
35-
from airbyte_cdk.legacy.sources.declarative.declarative_stream import DeclarativeStream
3635
from airbyte_cdk.models import (
3736
AirbyteLogMessage,
3837
AirbyteMessage,
@@ -440,12 +439,8 @@
440439
}
441440

442441

443-
def get_retriever(stream: Union[DeclarativeStream, DefaultStream]):
444-
return (
445-
stream.retriever
446-
if isinstance(stream, DeclarativeStream)
447-
else stream._stream_partition_generator._partition_factory._retriever
448-
)
442+
def get_retriever(stream: DefaultStream):
443+
return stream._stream_partition_generator._partition_factory._retriever
449444

450445

451446
@pytest.fixture
@@ -985,12 +980,6 @@ def create_mock_retriever(name, url_base, path):
985980
return http_stream
986981

987982

988-
def create_mock_declarative_stream(http_stream):
989-
declarative_stream = mock.Mock(spec=DeclarativeStream, autospec=True)
990-
declarative_stream.retriever = http_stream
991-
return declarative_stream
992-
993-
994983
@pytest.mark.parametrize(
995984
"test_name, config, expected_max_records, expected_max_slices, expected_max_pages_per_slice",
996985
[

unit_tests/sources/declarative/partition_routers/test_cartesian_product_partition_router.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from airbyte_cdk.sources.types import StreamSlice
2323

2424

25+
# todo: All these tests rely on stream_slicers that are of a the deprecated legacy class DatetimeBasedCursor these
26+
# should really be ConcurrentCursor, but this fix is a bit tedious and are tested in other parts of the code
2527
@pytest.mark.parametrize(
2628
"test_name, stream_slicers, expected_slices",
2729
[

unit_tests/sources/declarative/retrievers/test_simple_retriever.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import pytest
1111
import requests
1212

13-
# todo: These can be removed once SimpleRetriever deprecated the now unused state methods
1413
from airbyte_cdk.legacy.sources.declarative.incremental import (
1514
DatetimeBasedCursor,
1615
DeclarativeCursor,

0 commit comments

Comments
 (0)