From 7bffaa6d412ee73aaf0b3ef2a21a8dc73ccf01e8 Mon Sep 17 00:00:00 2001 From: Laurent Savaete Date: Mon, 28 Mar 2022 13:09:03 +0300 Subject: [PATCH 1/2] Add repo context to commits stream --- tap_github/repository_streams.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tap_github/repository_streams.py b/tap_github/repository_streams.py index 95e310c4..7dac7594 100644 --- a/tap_github/repository_streams.py +++ b/tap_github/repository_streams.py @@ -880,9 +880,14 @@ def post_process(self, row: dict, context: Optional[dict] = None) -> dict: is used to compare to the `since` argument that the endpoint supports. """ row["commit_timestamp"] = row["commit"]["committer"]["date"] + # add some context info to help downstream processing + row["repo"] = context["repo"] + row["org"] = context["org"] return row schema = th.PropertiesList( + th.Property("org", th.StringType), + th.Property("repo", th.StringType), th.Property("node_id", th.StringType), th.Property("url", th.StringType), th.Property("sha", th.StringType), From d769a8d5fa4733ac46075ddf3c0a09bf53ff6085 Mon Sep 17 00:00:00 2001 From: Laurent Savaete Date: Wed, 30 Mar 2022 10:04:04 +0300 Subject: [PATCH 2/2] Fix mypy error --- tap_github/repository_streams.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tap_github/repository_streams.py b/tap_github/repository_streams.py index 7dac7594..43eadecd 100644 --- a/tap_github/repository_streams.py +++ b/tap_github/repository_streams.py @@ -881,6 +881,7 @@ def post_process(self, row: dict, context: Optional[dict] = None) -> dict: """ row["commit_timestamp"] = row["commit"]["committer"]["date"] # add some context info to help downstream processing + assert context is not None, "CommitsStream was called without context" row["repo"] = context["repo"] row["org"] = context["org"] return row