I am using the SDK to develop a tap, and finding i...
# singer-tap-development
a
I am using the SDK to develop a tap, and finding it pretty straightforward, thanks to the docs and slack here šŸ™‚ Few head scratching moments here and there. Any suggestions how to handle a parent-child relationship, but when you don't want to query the child endpoint as you iterate over parents? For instance, ticket 1 has children chats 3,4,5, but if I query
chats
as I iterate over each
ticket
this messes up the pagination of
tickets
, and some get missed. If I iterate over all the tickets first, then go back and query
chats
for each ticket I have collected, that should work. Is there an off-the-shelf way to do this, or do I have to put together something new?
d
What is your streams structure? Does it follow example?
a
Sort of. What I need to do is collect a series of iids from
all_tickets
endpoint, then iterate over those in the main
Ticket
class, calling
tickets/{iid}
and then
tickets/{iid}/conversations
for my
Conversations
stream.
d
So, you want 3 streams
tickets list
→
individual ticket info
→
ticket conversations
, right?
a
Yes, but I don't actually want the first
tickets list
stream written out, that only returns the ticket IDs that have updated, and then I need to iterate over those IDs, passing each one to the
ticket
endpoint in turn to retrieve full detail for a ticket.
Basically the
tickets
stream has no pagination itself, and relies on a series of input IDs generated dynamically
d
Does the
tickets list
endpoint have any input? E.g., last id or updated date?
a
Yes, I pass
updated_since
to
tickets_list
, which gets me a iterable of ticket ids.
Then I need a stream of
tickets
, one for each of the returned ids.
d
I’d go with 2 streams setup: 1. Tickets (similar to
EpicsStream
from example) a. Request
tickets list
endpoint inside
get_records()
b. Iterate response and request
individual ticket info
endpoint for each ticket (still inside
get_records()
) c. Yield each row from the response d. Use
get_child_context()
to return dict with keys required to request conversations 2. Conversations (similar to
EpicIssuesStream
) a. Set
parent_stream_type = Tickets
b. Request
ticket conversations
endpoint using keys received from parent (
get_child_context()
from Tickets stream)
a
Thanks, I'm just getting familiar with the overridable methods, I'll check out
get_records()
I think I have it working for a hardcoded of input
ticket_ids
, thanks! I feel like I am creating some kind of frankentap though 🧌
d
Yeah, I had the same feeling when I was building my first tap šŸ™‚ Reading through sources of freshly published taps on github helped a lot to build connection between docs and implementations.