Hi everyone, I have question. I want to take list ...
# ask-community-for-troubleshooting
z
Hi everyone, I have question. I want to take list of ids from one stream and then execute another stream on all those ids. Is there a recursive way to do that?
z
My problem is that the url needs to be updated based on id.
c
Hey @Zawar Khan, I faced that same issue recently. There might be a better way, but on the 2nd stream class, do something like this:
Copy code
def read_records(self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_slice: Mapping[str, Any] = None, stream_state: Mapping[str, Any] = None) -> Iterable[Mapping[str, Any]]:
        parent_stream_class = ParentStreamClass(**kwargs)
        for parent_stream in parent_stream_class.read_records(sync_mode=SyncMode.full_refresh):
            yield from super().read_records(sync_mode=SyncMode.full_refresh,stream_slice={"id-from_parent_stream":parent_stream["id"]})
Then, in the path have:
Copy code
def path(self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None) -> str:
        stream_id = stream_slice["previous_stream_id"]
        return f"team/{stream_id}/folder"
👀 1
👍 1