Skip to content
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 Intercom: Fix "updated_at" data type #6087

Merged
merged 4 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sourceDefinitionId": "d8313939-3782-41b0-be29-b3ca20d8dd3a",
"name": "Intercom",
"dockerRepository": "airbyte/source-intercom",
"dockerImageTag": "0.1.3",
"dockerImageTag": "0.1.4",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/intercom",
"icon": "intercom.svg"
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
- sourceDefinitionId: d8313939-3782-41b0-be29-b3ca20d8dd3a
name: Intercom
dockerRepository: airbyte/source-intercom
dockerImageTag: 0.1.3
dockerImageTag: 0.1.4
documentationUrl: https://docs.airbyte.io/integrations/sources/intercom
icon: intercom.svg
- sourceDefinitionId: 68e63de2-bb83-4c7e-93fa-a8a9051e3993
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-intercom/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_intercom ./source_intercom
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.version=0.1.4
LABEL io.airbyte.name=airbyte/source-intercom
14 changes: 7 additions & 7 deletions airbyte-integrations/connectors/source-intercom/integration_tests/abnormal_state.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"companies": {
"updated_at": "2022-07-12T10:44:09+00:00"
"updated_at": 7626086649
},
"company_segments": {
"updated_at": "2022-07-12T10:44:09+00:00"
"updated_at": 7626086649
},
"conversations": {
"updated_at": "2022-07-12T10:44:09+00:00"
"updated_at": 7626086649
},
"conversation_parts": {
"updated_at": "2022-07-12T10:44:09+00:00"
"updated_at": 7626086649
},
"contacts": {
"updated_at": "2022-07-12T10:44:09+00:00"
"updated_at": 7626086649
},
"segments": {
"updated_at": "2022-07-12T10:44:09+00:00"
"updated_at": 7626086649
}
}
}
12 changes: 6 additions & 6 deletions airbyte-integrations/connectors/source-intercom/integration_tests/sample_state.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"companies": {
"updated_at": "2019-07-12T11:22:46+00:00"
"updated_at": 1626086649
},
"company_segments": {
"updated_at": "2019-07-12T11:22:46+00:00"
"updated_at": 1626086649
},
"conversations": {
"updated_at": "2019-07-12T11:22:46+00:00"
"updated_at": 1626086649
},
"conversation_parts": {
"updated_at": "2019-07-12T11:22:46+00:00"
"updated_at": 1626086649
},
"contacts": {
"updated_at": "2019-07-12T11:22:46+00:00"
"updated_at": 1626086649
},
"segments": {
"updated_at": "2019-07-12T11:22:46+00:00"
"updated_at": 1626086649
}
}
3 changes: 1 addition & 2 deletions airbyte-integrations/connectors/source-intercom/source_intercom/schemas/companies.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"type": ["null", "integer"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
},
"monthly_spend": {
"type": ["null", "number"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"type": ["null", "boolean"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"type": ["null", "string"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
}
}
}
3 changes: 1 addition & 2 deletions airbyte-integrations/connectors/source-intercom/source_intercom/schemas/contacts.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
"type": ["null", "integer"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
},
"signed_up_at": {
"type": ["null", "integer"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@
"type": ["null", "string"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
},
"redacted": {
"type": ["null", "boolean"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@
"type": ["null", "string"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
},
"user": {
"type": ["null", "object"],
Expand Down
3 changes: 1 addition & 2 deletions airbyte-integrations/connectors/source-intercom/source_intercom/schemas/segments.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"type": ["null", "string"]
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
"type": ["null", "integer"]
}
}
}
9 changes: 2 additions & 7 deletions airbyte-integrations/connectors/source-intercom/source_intercom/source.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ def parse_response(self, response: requests.Response, stream_state: Mapping[str,
record = super().parse_response(response, stream_state, **kwargs)

for record in record:
updated_at = record.get(self.cursor_field)

if updated_at:
record[self.cursor_field] = datetime.fromtimestamp(
record[self.cursor_field]
).isoformat() # convert timestamp to datetime string

yield from self.filter_by_state(stream_state=stream_state, record=record)

def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, any]:
Expand Down Expand Up @@ -335,6 +328,8 @@ def check_connection(self, logger, config) -> Tuple[bool, any]:
def streams(self, config: Mapping[str, Any]) -> List[Stream]:
AirbyteLogger().log("INFO", f"Using start_date: {config['start_date']}")

config["start_date"] = datetime.strptime(config["start_date"], "%Y-%m-%dT%H:%M:%SZ").timestamp()

auth = TokenAuthenticator(token=config["access_token"])
return [
Admins(authenticator=auth, **config),
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/intercom.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Please read [How to get your Access Token](https://developers.intercom.com/build

| Version | Date | Pull Request | Subject |
| :------ | :-------- | :----- | :------ |
| 0.1.4 | 2021-09-20 | [6087](https://github.com/airbytehq/airbyte/pull/6087) | Corrected updated_at field data type in schemas |
| 0.1.3 | 2021-09-08 | [5908](https://github.com/airbytehq/airbyte/pull/5908) | Corrected timestamp and arrays in schemas |
| 0.1.2 | 2021-08-19 | [5531](https://github.com/airbytehq/airbyte/pull/5531) | Corrected pagination |
| 0.1.1 | 2021-07-31 | [5123](https://github.com/airbytehq/airbyte/pull/5123) | Corrected rate limit |
Expand Down