Skip to content

Commit

Permalink
CDK: Avoid duplicate HTTP query in simple_retriever (#19485)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
  • Loading branch information
grubberr authored Nov 16, 2022
1 parent 64cfb38 commit 22d226a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 3 additions & 0 deletions airbyte-cdk/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.9.3
Low-code: Avoid duplicate HTTP query in `simple_retriever`

## 0.9.2
Low-code: Make `default_paginator.page_token_option` optional

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,7 @@ def read_records(
# Warning: use self.state instead of the stream_state passed as argument!
stream_slice = stream_slice or {} # None-check
self.paginator.reset()
records_generator = self._read_pages(
lambda req, res, state, _slice: self.parse_records_and_emit_request_and_responses(
req, res, stream_slice=_slice, stream_state=state
),
records_generator = self._read_pages(self.parse_records_and_emit_request_and_responses,
stream_slice,
stream_state,
)
Expand Down Expand Up @@ -411,9 +408,7 @@ def parse_records_and_emit_request_and_responses(self, request, response, stream
yield self._create_trace_message_from_response(response)
# Not great to need to call _read_pages which is a private method
# A better approach would be to extract the HTTP client from the HttpStream and call it directly from the HttpRequester
yield from self._read_pages(
lambda req, res, state, _slice: self.parse_response(res, stream_slice=_slice, stream_state=state), stream_slice, stream_state
)
yield from self.parse_response(response, stream_slice=stream_slice, stream_state=stream_state)

def _create_trace_message_from_request(self, request: requests.PreparedRequest):
# FIXME: this should return some sort of trace message
Expand Down
2 changes: 1 addition & 1 deletion airbyte-cdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="airbyte-cdk",
version="0.9.2",
version="0.9.3",
description="A framework for writing Airbyte Connectors.",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 22d226a

Please sign in to comment.