Skip to content

Commit

Permalink
workaround and TODOs for random issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Mar 7, 2022
1 parent 6be1da0 commit f132f40
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tap_gitlab/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def post_process(self, row: dict, context: Optional[dict] = None) -> Optional[di
result["owner_id"] = pop_nested_id(result, "owner")
return result

def get_child_context(self, record: dict, context: Optional[dict]) -> dict:
assert context is not None
return {
"project_id": record["id"],
"project_path": context["project_path"],
}


class IssuesStream(ProjectBasedStream):
"""Gitlab Issues stream."""
Expand Down Expand Up @@ -102,6 +109,20 @@ class BranchesStream(ProjectBasedStream):
name = "branches"
path = "/projects/{project_path}/repository/branches"
primary_keys = ["project_id", "name"]
# TODO: Research why this fails:
# parent_stream_type = ProjectsStream

def post_process(self, row: dict, context: Optional[dict] = None) -> Optional[dict]:
result = super().post_process(row, context)
if result is None:
return None

assert context is not None

# TODO: Uncomment when parent relationship works
# result["project_id"] = context["project_id"]
result["commit_id"] = pop_nested_id(result, "commit")
return result


class PipelinesStream(ProjectBasedStream):
Expand Down

0 comments on commit f132f40

Please sign in to comment.