Hey, is it possible to have a stream write to mult...
# singer-tap-development
a
Hey, is it possible to have a stream write to multiple tables? I am working on a Tap pulling data from an API. Some of the returned data is nested as "dictionaries", "lists" or a combination of both. Find a simplified example below:
Copy code
{
    'id': 123,
    'name': 'abc',
    'address': {
        'street': 'abc',
        'city': 'abc',
        'zip': 111,
    },
    'items': ['x', 'y', 'z'],
}
My solution so far is to either • explode the "dictionaries" if the response does not contain "lists" • or to make the same API call several times within different streams. One stream for the top-level columns (base table), another stream for the level-1 columns (sub-table). another stream for the level-2 columns (sub-sub-table), and so on. Each time adjusting the expected schema and filtering for the desired columns in the "*parse_response*" function. For small responses and/or APIs with no rate limit, this is feasible, but it feels far from ideal. Does Meltano have a functionality to aid me here?
v
It's up to you and what makes the most sense for the tap. Strickly a
stream
is a different "table" This example you're giving is hard to help you, but if you give something concrete from an actual API I'd bet we can give recommendations. Generally you leave the json alone in the stream (just make a jsonschema element for the list) or it's important enough to split to another stream and you use Parent / Child streams https://sdk.meltano.com/en/v0.40.0/parent_streams.html Very dependent on what you want as a tap developer / consumer