Skip to content

Commit

Permalink
#1772 source mixpanel: fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
davydov-d committed Aug 31, 2023
1 parent 163f004 commit 7ff33e8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-mixpanel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]


LABEL io.airbyte.version=0.1.37
LABEL io.airbyte.version=0.1.38
LABEL io.airbyte.name=airbyte/source-mixpanel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 12928b32-bf0a-4f1e-964f-07e12e37153a
dockerImageTag: 0.1.37
dockerImageTag: 0.1.38
dockerRepository: airbyte/source-mixpanel
githubIssueLabel: source-mixpanel
icon: mixpanel.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def get_json_schema(self) -> Mapping[str, Any]:
types = {
"boolean": {"type": ["null", "boolean"]},
"number": {"type": ["null", "number"], "multipleOf": 1e-20},
"datetime": {"type": ["null", "string"], "format": "date-time"},
# no format specified as values can be "2021-12-16T00:00:00", "1638298874", "15/08/53895"
"datetime": {"type": ["null", "string"]},
"object": {"type": ["null", "object"], "additionalProperties": True},
"list": {"type": ["null", "array"], "required": False, "items": {}},
"string": {"type": ["null", "string"]},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,47 @@ def engage_schema_response():
200,
{
"results": {
"$browser": {"count": 124, "type": "string"},
"$browser_version": {"count": 124, "type": "string"},
"$created": {"count": 124, "type": "string"},
"$is_active": {"count": 412, "type": "boolean"},
"$CreatedDateTimestamp": {"count": 300, "type": "number"},
"$CreatedDate": {"count": 11, "type": "datetime"},
"$properties": {"count": 2, "type": "object"},
"$tags": {"count": 131, "type": "list"}
}
},
)


def test_engage_schema(requests_mock, engage_schema_response, config):

stream = EngageSchema(authenticator=MagicMock(), **config)
requests_mock.register_uri("GET", get_url_to_mock(stream), engage_schema_response)

records = stream.read_records(sync_mode=SyncMode.full_refresh)

records_length = sum(1 for _ in records)
assert records_length == 3
stream = Engage(authenticator=MagicMock(), **config)
requests_mock.register_uri("GET", get_url_to_mock(EngageSchema(authenticator=MagicMock(), **config)), engage_schema_response)
assert stream.get_json_schema() == {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": True,
"properties": {
"CreatedDate": {"type": ["null", "string"]},
"CreatedDateTimestamp": {"multipleOf": 1e-20, "type": ["null", "number"]},
"browser": {"type": ["null", "string"]},
"browser_version": {"type": ["null", "string"]},
"city": {"type": ["null", "string"]},
"country_code": {"type": ["null", "string"]},
"created": {"type": ["null", "string"]},
"distinct_id": {"type": ["null", "string"]},
"email": {"type": ["null", "string"]},
"first_name": {"type": ["null", "string"]},
"id": {"type": ["null", "string"]},
"is_active": {"type": ["null", "boolean"]},
"last_name": {"type": ["null", "string"]},
"last_seen": {"format": "date-time", "type": ["null", "string"]},
"name": {"type": ["null", "string"]},
"properties": {"additionalProperties": True, "type": ["null", "object"]},
"region": {"type": ["null", "string"]},
"tags": {"items": {}, "required": False, "type": ["null", "array"]},
"timezone": {"type": ["null", "string"]},
"unblocked": {"type": ["null", "string"]}
},
"type": "object"
}


def test_update_engage_schema(requests_mock, config):
Expand Down
3 changes: 2 additions & 1 deletion docs/integrations/sources/mixpanel.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Syncing huge date windows may take longer due to Mixpanel's low API rate-limits
## CHANGELOG

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------- |
|:--------|:-----------|:---------------------------------------------------------|:------------------------------------------------------------------------------------------------------------|
| 0.1.38 | 2022-08-31 | [00000](https://github.com/airbytehq/airbyte/pull/00000) | Do not specify `"format": "date-time"` for the date-time fields |
| 0.1.37 | 2022-07-20 | [27932](https://github.com/airbytehq/airbyte/pull/27932) | Fix spec: change start/end date format to `date` |
| 0.1.36 | 2022-06-27 | [27752](https://github.com/airbytehq/airbyte/pull/27752) | Partially revert version 0.1.32; Use exponential backoff; |
| 0.1.35 | 2022-06-12 | [27252](https://github.com/airbytehq/airbyte/pull/27252) | Add should_retry False for 402 error |
Expand Down

0 comments on commit 7ff33e8

Please sign in to comment.