stephen_bailey
07/28/2021, 5:52 PMlist_table
endpoint with table_detail
, table_viewers
, table_columns
child streams. What is the best way to handle this?
The way I have it built right now is with a ParentBaseStream
that I wanted to not sync (but which I wanted to define the pagination logic for), and then build child streams off of. It works for running the tap, but I can't figure out how to exclude it from being treated like a "normal" stream.stephen_bailey
07/28/2021, 5:52 PMParentBaseStream <--subclass-- DataSourceBaseStream <--child_of-- DataSourceStream
, for exampleaaronsteers
07/28/2021, 8:55 PMaaronsteers
07/28/2021, 8:56 PMstephen_bailey
07/29/2021, 10:19 AMSilentStream
is exactly what I'm looking for, but after some thinking, I'm actually not sure if it's the best approach for me. I think the best approach might be to add a post_process
call so that the list_tables
stream enriches each record that it returns using table_datail
, so that the parent is not silent but rather just requires an extra call to retrieve the full record.stephen_bailey
07/29/2021, 10:49 AMdef post_process(self, row: dict, context: Optional[dict] = None) -> dict:
"""Append data source and connection string to record."""
# Get additional data from direct endpoint
prepared_request = self.prepare_request(context=context, next_page_token=None)
prepared_request.url = f"{self.url_base}/project/{row['id']}"
prepared_request.params = {}
response = self._request_with_backoff(prepared_request, context)
# Set emitted record to be the detailed record
record = response.json()
return record
edgar_ramirez_mondragon
07/29/2021, 3:50 PMstephen_bailey
07/29/2021, 4:02 PMDuring data-append - The tap may need to supliment the core data with additional calls in the post_process() handler.
., and what I tried to avoid by using the private method _request_with_backoff
. the developer would likely implement calls against the requests library directly.
🙂
It's not ideal, because I'm not sure what the behavior would be if one of the post_process
calls failed -- would the row fail, or the stream break? -- but it allowed me to stay within the built-in logic of the SDK