- Notifications
You must be signed in to change notification settings - Fork 4.9k
Source Mailchimp: handle records with no no "activity" field in response #5024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source Mailchimp: handle records with no no "activity" field in response #5024
Conversation
| /test connector=connectors/source-mailchimp
|
| # -> [[{'campaign_id', 'list_id', 'list_is_active', 'email_id', 'email_address', '**activity[i]', '_links'}, ...]] | ||
| data = response_json[self.data_field] | ||
| for item in data: | ||
| for activity_record in item["activity"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb just
for activity_record in item.get("activity", []):?
| /test connector=connectors/source-mailchimp
|
| for activity_record in item["activity"]: | ||
| new_record = {k: v for k, v in item.items() if k != "activity"} | ||
| for k, v in activity_record.items(): | ||
| new_record[k] = v | ||
| yield new_record |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or somthing like this
| for activity_record in item["activity"]: | |
| new_record = {k: v for k, v in item.items() if k != "activity"} | |
| for k, v in activity_record.items(): | |
| new_record[k] = v | |
| yield new_record | |
| for activity_item in item.pop("activity", []): | |
| yield {**item, **activity_item} |
keu left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment
| /test connector=connectors/source-mailchimp
|
…ible_mailchimp_data_change
| /publish connector=connectors/source-mailchimp
|
| @vovavovavovavova please remember to add the 🎉 emoji to the PR title to make it visible for changelog writers |
What
Closes #4787
How
The email-activity web response usually contains the set of fields, including "activity" - main resource field. Using our data, we always receiving this field, it may be an empty array, but it always exist. In the issue we might have unexpected case that response does not contain this field, so it fails with an exception. Now those records are skipped, like it was on empty array - additional reason that the cursor field is located inside this field.
Since we cannot debug user data, assuming this can close the issue.
Some schemas were changed too.
Recommended reading order
x.javay.pythonPre-merge Checklist
Expand the checklist which is relevant for this PR.
Connector checklist
airbyte_secretin the connector's spec./gradlew :airbyte-integrations:connectors:<name>:integrationTest./test connector=connectors/<name>command as documented here is passing.README.mddocs/SUMMARY.mdif it's a new connectordocs/integrations/<source or destination>/<name>.docs/integrations/.... See changelog exampledocs/integrations/README.mdcontains a reference to the new connector/publishcommand described hereConnector Generator checklist
-scaffoldin their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplatesthen checking in your changes