Andy Carter
04/14/2023, 1:01 PMmeltano run
or when testing in VSCode?
👇
EDIT: Found it, difference between $.items[*]
and $.items.[*]
in json path.
Have to look at the json path evaluator with "Output Paths" turned onAndy Carter
04/14/2023, 1:02 PMclass CampaignsStream(MailchimpStream):
"""Define custom stream."""
name = "campaigns"
path = "/campaigns"
response_key = "campaigns"
primary_keys = ["id"]
replication_method = 'FULL_TABLE'
def get_child_context(self, record: dict, context: dict | None) -> dict | None:
return {
'campaign_id': record['campaign_id']
}
class ReportsEmailActivity(MailchimpStream):
name = 'reports_email_activity'
path = '/reports/{campaign_id}/email_activity'
parent_stream_type = CampaignsStream
response_key = 'emails'
primary_keys = [
'campaign_id',
'action',
'email_id',
'timestamp',
]
ignore_parent_replication_key = True
I can only see Campaigns running and paginating correctly, but ReportsEmailActivity isn't running, it's like the stream simply doesn't exist.Andy Carter
04/14/2023, 1:02 PMdef discover_streams(self) -> list[streams.MailchimpStream]:
"""Return a list of discovered streams.
Returns:
A list of discovered streams.
"""
return [
streams.CampaignsStream(self),
streams.ReportsEmailActivity(self),
streams.ListsStream(self),
streams.ListsMembersStream(self),
]
Andy Carter
04/14/2023, 1:12 PMAndy Carter
04/14/2023, 1:16 PMAndy Carter
04/14/2023, 1:18 PMedgar_ramirez_mondragon
04/14/2023, 1:55 PMvisch
04/14/2023, 3:33 PM$.item.*
instead of $.item[*]
and it return 0. A feature like this would helpAndy Carter
04/14/2023, 3:37 PMhas_more
is to keep incrementing page number until get an empty page, and then return bool(len(response.json()))
. You don't know you're at the end of the records until the first page that returns an empty list.edgar_ramirez_mondragon
04/14/2023, 5:32 PM