Hi, this is for other python and singer novices. I...
# singer-tap-development
s
Hi, this is for other python and singer novices. I’m writing a tap for clickup. In several of their endpoints, instead of returning an array of results, they return an object with an array corresponding to the endpoint. i.e. for the teams endpoint, they would return:
Copy code
{
    "teams": [
        {...},
        {...}
    ]
}
Some endpoints do it, some don’t. I want to insert the objects in teams[] into Snowflake instead as rows instead of a single row called teams. I worked it out this way: Add
def parse_response()
to my class and
yield
each object in the array with a for loop.
Copy code
def parse_response(self, response) -> Iterable[dict]:
        """Parse Google Analytics API response into individual records."""

        data =response.json().get("teams")
        for team in data:
            yield team
s
i hit this with my
tap-immuta
as well. i added
response_result_key
property to the top-level Stream class, which could be defined by each subclass. Then i did the same thing as you in `parse_response`:
Copy code
if self.response_result_key:
   resp_json = resp_json.get(self.response_result_key)