diff --git a/airbyte-cdk/python/airbyte_cdk/connector_builder/connector_builder_handler.py b/airbyte-cdk/python/airbyte_cdk/connector_builder/connector_builder_handler.py index cdee4f7c3574..b3cfd9a0503b 100644 --- a/airbyte-cdk/python/airbyte_cdk/connector_builder/connector_builder_handler.py +++ b/airbyte-cdk/python/airbyte_cdk/connector_builder/connector_builder_handler.py @@ -50,6 +50,7 @@ def create_source(config: Mapping[str, Any], limits: TestReadLimits) -> Manifest limit_pages_fetched_per_slice=limits.max_pages_per_slice, limit_slices_fetched=limits.max_slices, disable_retries=True, + disable_cache=True, ), ) diff --git a/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py b/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py index c0e66d1ff43d..fdef2551153b 100644 --- a/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +++ b/airbyte-cdk/python/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py @@ -159,6 +159,7 @@ def __init__( limit_slices_fetched: Optional[int] = None, emit_connector_builder_messages: bool = False, disable_retries: bool = False, + disable_cache: bool = False, message_repository: Optional[MessageRepository] = None, ): self._init_mappings() @@ -166,6 +167,7 @@ def __init__( self._limit_slices_fetched = limit_slices_fetched self._emit_connector_builder_messages = emit_connector_builder_messages self._disable_retries = disable_retries + self._disable_cache = disable_cache self._message_repository = message_repository or InMemoryMessageRepository( # type: ignore self._evaluate_log_level(emit_connector_builder_messages) ) @@ -825,6 +827,8 @@ def create_http_requester(self, model: HttpRequesterModel, decoder: Decoder, con assert model.use_cache is not None # for mypy assert model.http_method is not None # for mypy + use_cache = model.use_cache and not self._disable_cache + return HttpRequester( name=name, url_base=model.url_base, @@ -837,7 +841,7 @@ def create_http_requester(self, model: HttpRequesterModel, decoder: Decoder, con disable_retries=self._disable_retries, parameters=model.parameters or {}, message_repository=self._message_repository, - use_cache=model.use_cache, + use_cache=use_cache, decoder=decoder, stream_response=decoder.is_stream_response() if decoder else False, ) @@ -1199,6 +1203,7 @@ def _create_message_repository_substream_wrapper(self, model: ParentStreamConfig limit_slices_fetched=self._limit_slices_fetched, emit_connector_builder_messages=self._emit_connector_builder_messages, disable_retries=self._disable_retries, + disable_cache=self._disable_cache, message_repository=LogAppenderMessageRepositoryDecorator( {"airbyte_cdk": {"stream": {"is_substream": True}}, "http": {"is_auxiliary": True}}, self._message_repository, diff --git a/airbyte-cdk/python/unit_tests/connector_builder/test_connector_builder_handler.py b/airbyte-cdk/python/unit_tests/connector_builder/test_connector_builder_handler.py index ca6b8e47ea68..2c5f90ff84d2 100644 --- a/airbyte-cdk/python/unit_tests/connector_builder/test_connector_builder_handler.py +++ b/airbyte-cdk/python/unit_tests/connector_builder/test_connector_builder_handler.py @@ -709,6 +709,7 @@ def test_create_source(): assert isinstance(source, ManifestDeclarativeSource) assert source._constructor._limit_pages_fetched_per_slice == limits.max_pages_per_slice assert source._constructor._limit_slices_fetched == limits.max_slices + assert source._constructor._disable_cache def request_log_message(request: dict) -> AirbyteMessage: