From ea8bdb75b00fc6a3faf037d0318872bf7c2b866b Mon Sep 17 00:00:00 2001 From: Sergey Chvalyuk Date: Wed, 23 Feb 2022 19:05:59 +0200 Subject: [PATCH] Organizations.transform added Signed-off-by: Sergey Chvalyuk --- .../source-github/source_github/streams.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/airbyte-integrations/connectors/source-github/source_github/streams.py b/airbyte-integrations/connectors/source-github/source_github/streams.py index 6de0111aad8c..e51b7445a960 100644 --- a/airbyte-integrations/connectors/source-github/source_github/streams.py +++ b/airbyte-integrations/connectors/source-github/source_github/streams.py @@ -331,6 +331,10 @@ def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str: def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: yield response.json() + def transform(self, record: MutableMapping[str, Any], stream_slice: Mapping[str, Any]) -> MutableMapping[str, Any]: + record["organization"] = stream_slice["organization"] + return record + class Repositories(Organizations): """ @@ -344,10 +348,6 @@ def parse_response(self, response: requests.Response, stream_slice: Mapping[str, for record in response.json(): # GitHub puts records in an array. yield self.transform(record=record, stream_slice=stream_slice) - def transform(self, record: MutableMapping[str, Any], stream_slice: Mapping[str, Any]) -> MutableMapping[str, Any]: - record["organization"] = stream_slice["organization"] - return record - class Tags(GithubStream): """ @@ -372,10 +372,6 @@ def parse_response(self, response: requests.Response, stream_slice: Mapping[str, for record in response.json(): yield self.transform(record=record, stream_slice=stream_slice) - def transform(self, record: MutableMapping[str, Any], stream_slice: Mapping[str, Any]) -> MutableMapping[str, Any]: - record["organization"] = stream_slice["organization"] - return record - class Users(Organizations): """ @@ -389,10 +385,6 @@ def parse_response(self, response: requests.Response, stream_slice: Mapping[str, for record in response.json(): yield self.transform(record=record, stream_slice=stream_slice) - def transform(self, record: MutableMapping[str, Any], stream_slice: Mapping[str, Any]) -> MutableMapping[str, Any]: - record["organization"] = stream_slice["organization"] - return record - # Below are semi incremental streams