Skip to content

Commit

Permalink
Update issue comments stream to be a child of repositories and update…
Browse files Browse the repository at this point in the history
… schema
  • Loading branch information
laurentS committed Sep 10, 2021
1 parent 59bdbb9 commit 71b07b7
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions tap_github/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,17 @@ def http_headers(self) -> dict:


class IssueCommentsStream(GitHubStream):
"""Defines 'Issues' stream."""
"""
Defines 'Issues' stream.
Issue comments are fetched from the repository level (as opposed to per issue)
to optimize for API quota usage.
"""

name = "issue_comments"
path = "/repos/{org}/{repo}/issues/{issue_number}/comments"
path = "/repos/{org}/{repo}/issues/comments"
primary_keys = ["id"]
replication_key = "updated_at"
parent_stream_type = IssuesStream
parent_stream_type = RepositoryStream
state_partitioning_keys = ["repo", "org"]
ignore_parent_replication_key = False

Expand Down Expand Up @@ -278,11 +282,25 @@ def get_url_params(

schema = th.PropertiesList(
th.Property("id", th.IntegerType),
th.Property("node_id", th.StringType),
th.Property("repo", th.StringType),
th.Property("org", th.StringType),
th.Property("issue_number", th.IntegerType),
th.Property("issue_url", th.IntegerType),
th.Property("updated_at", th.DateTimeType),
th.Property("created_at", th.DateTimeType),
th.Property("author_association", th.StringType),
th.Property("body", th.StringType),
th.Property(
"user",
th.ObjectType(
th.Property("login", th.StringType),
th.Property("id", th.IntegerType),
th.Property("node_id", th.StringType),
th.Property("avatar_url", th.StringType),
th.Property("gravatar_id", th.StringType),
th.Property("html_url", th.StringType),
th.Property("type", th.StringType),
th.Property("site_admin", th.BooleanType),
),
),
).to_dict()

0 comments on commit 71b07b7

Please sign in to comment.