Skip to content

Commit

Permalink
Source Mailchimp: Add expected records (#32226)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristoGrab authored Nov 14, 2023
1 parent dc48c4f commit d53dcb4
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ acceptance_tests:
tests:
- config_path: "secrets/config.json"
expect_records:
bypass_reason: "Risk to disclose internal data. Need to set up a sandbox account - https://github.com/airbytehq/airbyte/issues/20726"
path: "integration_tests/expected_records.jsonl"
fail_on_extra_columns: false
empty_streams:
- name: "automations"
bypass_reason: "Cannot seed in free sandbox account, need to upgrade to paid account."
- config_path: "secrets/config_oauth.json"
expect_records:
bypass_reason: "Risk to disclose internal data. Need to set up a sandbox account - https://github.com/airbytehq/airbyte/issues/20726"
path: "integration_tests/expected_records.jsonl"
extra_records: True
fail_on_extra_columns: false
empty_streams:
- name: "automations"
bypass_reason: "Cannot seed in free sandbox account, need to upgrade to paid account."
incremental:
tests:
- config_path: "secrets/config.json"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"type": "STREAM",
"stream": {
"stream_state": {
"00f14fbfd8": { "timestamp": "2230-11-23T05:42:10+00:00" }
"7847cdaeff": { "timestamp": "2230-11-23T05:42:10+00:00" }
},
"stream_descriptor": { "name": "email_activity" }
}
Expand All @@ -33,7 +33,7 @@
"type": "STREAM",
"stream": {
"stream_state": {
"f59b426832": { "last_changed": "2230-02-26T05:42:10+00:00" }
"16d6ec4ffc": { "last_changed": "2230-02-26T05:42:10+00:00" }
},
"stream_descriptor": { "name": "list_members" }
}
Expand All @@ -49,7 +49,7 @@
"type": "STREAM",
"stream": {
"stream_state": {
"f59b426832": { "updated_at": "2230-02-26T05:42:10+00:00" }
"16d6ec4ffc": { "updated_at": "2230-02-26T05:42:10+00:00" }
},
"stream_descriptor": { "name": "segments" }
}
Expand All @@ -58,7 +58,7 @@
"type": "STREAM",
"stream": {
"stream_state": {
"00f14fbfd8": { "timestamp": "2231-09-26T05:42:10+00:00" }
"7847cdaeff": { "timestamp": "2231-09-26T05:42:10+00:00" }
},
"stream_descriptor": { "name": "unsubscribes" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: b03a9f3e-22a5-11eb-adc1-0242ac120002
dockerImageTag: 0.8.0
dockerImageTag: 0.8.1
dockerRepository: airbyte/source-mailchimp
documentationUrl: https://docs.airbyte.com/integrations/sources/mailchimp
githubIssueLabel: source-mailchimp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"description": "The number of unique clicks divided by the total number of successful deliveries."
},
"last_click": {
"type": "string",
"type": ["null", "string"],
"format": "date-time",
"title": "Last Click",
"description": "The date and time of the last recorded click for the campaign in ISO 8601 format."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
"type": "string",
"title": "Campaign Type",
"description": "There are four types of [campaigns](https://mailchimp.com/help/getting-started-with-campaigns/) you can create in Mailchimp. A/B Split campaigns have been deprecated and variate campaigns should be used instead.",
"enum": ["regular", "plaintext", "absplit", "rss", "variate"]
"enum": [
"automation-email",
"regular",
"plaintext",
"absplit",
"rss",
"variate"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,19 @@ class Reports(IncrementalMailChimpStream):
def path(self, **kwargs) -> str:
return "reports"

def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:

response = super().parse_response(response, **kwargs)

# In some cases, the 'last_click' field is returned as an empty string,
# which causes validation errors on the `date-time` format.
# To avoid this, we remove the field if it is empty.
for record in response:
clicks = record.get("clicks", {})
if not clicks.get("last_click"):
clicks.pop("last_click", None)
yield record


class Segments(MailChimpListSubStream):
"""
Expand Down
3 changes: 2 additions & 1 deletion docs/integrations/sources/mailchimp.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ Now that you have set up the Mailchimp source connector, check out the following

| Version | Date | Pull Request | Subject |
|---------|------------|----------------------------------------------------------|----------------------------------------------------------------------------|
| 0.8.0 | 2023-11-01 | [32032](https://github.com/airbytehq/airbyte/pull/32032) | Add ListMembers stream
| 0.8.1 | 2023-11-06 | [32226](https://github.com/airbytehq/airbyte/pull/32226) | Unmute expected records test after data anonymisation |
| 0.8.0 | 2023-11-01 | [32032](https://github.com/airbytehq/airbyte/pull/32032) | Add ListMembers stream |
| 0.7.0 | 2023-10-27 | [31940](https://github.com/airbytehq/airbyte/pull/31940) | Implement availability strategy |
| 0.6.0 | 2023-10-27 | [31922](https://github.com/airbytehq/airbyte/pull/31922) | Add Segments stream |
| 0.5.0 | 2023-10-20 | [31675](https://github.com/airbytehq/airbyte/pull/31675) | Add Unsubscribes stream |
Expand Down

0 comments on commit d53dcb4

Please sign in to comment.