Document how parent context fields are included in the child record
When user parent-child streams with the SDK as documented in https://sdk.meltano.com/en/latest/parent_streams.html
class GitlabStream(RESTStream):
# Base stream definition with auth and pagination logic
# This logic works for other base classes as well, including Stream, GraphQLStream, etc.
class EpicsStream(GitlabStream):
name = "epics"
# ...
def get_child_context(self, record: dict, context: Optional[dict]) -> dict:
"""Return a context dictionary for child streams."""
return {
"group_id": record["group_id"],
"epic_id": record["id"],
"epic_iid": record["iid"],
}
class EpicIssuesStream(GitlabStream):
# Note that this class inherits from the GitlabStream base class, and not from
# the EpicsStream class.
name = "epic_issues"
# EpicIssues streams should be invoked once per parent epic:
parent_stream_type = EpicsStream
# Assume epics don't have `updated_at` incremented when issues are changed:
ignore_parent_replication_keys = True
# Path is auto-populated using parent context keys:
path = "/groups/{group_id}/epics/{epic_iid}/issues"
# ...
the docs fail to mention that group_id, epic_id and epic_iid are all added to the child epic_issues records and should the dev want them, they need to be included in the stream schema.
Edited by Edgar R. Mondragón