Skip to content

Commit b75295a

Browse files
authored
Source Github: get_updated_state problem on reviews stream (#11567)
* Improve error handling for `reviews` stream Signed-off-by: Sergey Chvalyuk <[email protected]>
1 parent 152af7c commit b75295a

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
- name: GitHub
253253
sourceDefinitionId: ef69ef6e-aa7f-4af1-a01d-ef775033524e
254254
dockerRepository: airbyte/source-github
255-
dockerImageTag: 0.2.24
255+
dockerImageTag: 0.2.25
256256
documentationUrl: https://docs.airbyte.io/integrations/sources/github
257257
icon: github.svg
258258
sourceType: api

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2380,7 +2380,7 @@
23802380
supportsNormalization: false
23812381
supportsDBT: false
23822382
supported_destination_sync_modes: []
2383-
- dockerImage: "airbyte/source-github:0.2.24"
2383+
- dockerImage: "airbyte/source-github:0.2.25"
23842384
spec:
23852385
documentationUrl: "https://docs.airbyte.com/integrations/sources/github"
23862386
connectionSpecification:

airbyte-integrations/connectors/source-github/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ RUN pip install .
1212
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
1313
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1414

15-
LABEL io.airbyte.version=0.2.24
15+
LABEL io.airbyte.version=0.2.25
1616
LABEL io.airbyte.name=airbyte/source-github

airbyte-integrations/connectors/source-github/source_github/streams.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ def get_updated_state(self, current_stream_state: MutableMapping[str, Any], late
206206
Return the latest state by comparing the cursor value in the latest record with the stream's most recent state
207207
object and returning an updated state object.
208208
"""
209-
state_value = latest_cursor_value = latest_record.get(self.cursor_field)
210-
current_repository = latest_record["repository"]
211-
212-
if current_stream_state.get(current_repository, {}).get(self.cursor_field):
213-
state_value = max(latest_cursor_value, current_stream_state[current_repository][self.cursor_field])
214-
current_stream_state[current_repository] = {self.cursor_field: state_value}
209+
repository = latest_record["repository"]
210+
updated_state = latest_record[self.cursor_field]
211+
stream_state_value = current_stream_state.get(repository, {}).get(self.cursor_field)
212+
if stream_state_value:
213+
updated_state = max(updated_state, stream_state_value)
214+
current_stream_state.setdefault(repository, {})[self.cursor_field] = updated_state
215215
return current_stream_state
216216

217217
def get_starting_point(self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any]) -> str:

docs/integrations/sources/github.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ Your token should have at least the `repo` scope. Depending on which streams you
111111

112112
| Version | Date | Pull Request | Subject |
113113
|:--------|:-----------| :--- |:-------------------------------------------------------------------------------------------------------------|
114-
| 0.2.24 | 2022-03-30 | [9251](https://github.com/airbytehq/airbyte/pull/9251) | Add Streams Workflow and WorkflowRuns |
114+
| 0.2.25 | 2022-03-31 | [11567](https://github.com/airbytehq/airbyte/pull/11567) | Improve code for better error handling |
115+
| 0.2.24 | 2022-03-30 | [9251](https://github.com/airbytehq/airbyte/pull/9251) | Add Streams Workflow and WorkflowRuns |
115116
| 0.2.23 | 2022-03-17 | [11212](https://github.com/airbytehq/airbyte/pull/11212) | Improve documentation and spec for Beta |
116117
| 0.2.22 | 2022-03-10 | [10878](https://github.com/airbytehq/airbyte/pull/10878) | Fix error handling for unavailable streams with 404 status code |
117118
| 0.2.21 | 2022-03-04 | [10749](https://github.com/airbytehq/airbyte/pull/10749) | Add new stream `ProjectCards` |

0 commit comments

Comments
 (0)