Skip to content

Commit 9428b40

Browse files
authored
🐛 Source Mixpanel: Fix schemas and UI issues (#8256)
* Fixed schemas and ui issues * Deleted anyOf structure from schema * Updated PR number * Added fields with static data types to cohort_members schema * Add DefaultSchemaNormalization to Engage and CohortMembers streams * Changed Transformer name * Checkin specs
1 parent a2b31cc commit 9428b40

File tree

10 files changed

+130
-112
lines changed

10 files changed

+130
-112
lines changed

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/12928b32-bf0a-4f1e-964f-07e12e37153a.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "12928b32-bf0a-4f1e-964f-07e12e37153a",
33
"name": "Mixpanel",
44
"dockerRepository": "airbyte/source-mixpanel",
5-
"dockerImageTag": "0.1.5",
5+
"dockerImageTag": "0.1.6",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/mixpanel",
77
"icon": "mixpanel.svg"
88
}

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
- name: Mixpanel
394394
sourceDefinitionId: 12928b32-bf0a-4f1e-964f-07e12e37153a
395395
dockerRepository: airbyte/source-mixpanel
396-
dockerImageTag: 0.1.5
396+
dockerImageTag: 0.1.6
397397
documentationUrl: https://docs.airbyte.io/integrations/sources/mixpanel
398398
icon: mixpanel.svg
399399
sourceType: api

airbyte-config/init/src/main/resources/seed/source_specs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3719,7 +3719,7 @@
37193719
supportsNormalization: false
37203720
supportsDBT: false
37213721
supported_destination_sync_modes: []
3722-
- dockerImage: "airbyte/source-mixpanel:0.1.5"
3722+
- dockerImage: "airbyte/source-mixpanel:0.1.6"
37233723
spec:
37243724
documentationUrl: "https://docs.airbyte.io/integrations/sources/mixpanel"
37253725
connectionSpecification:

airbyte-integrations/connectors/source-mixpanel/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ RUN pip install .
1212
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
1313
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1414

15-
LABEL io.airbyte.version=0.1.5
15+
LABEL io.airbyte.version=0.1.6
1616
LABEL io.airbyte.name=airbyte/source-mixpanel

airbyte-integrations/connectors/source-mixpanel/source_mixpanel/schemas/cohort_members.json

+40
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,46 @@
88
},
99
"distinct_id": {
1010
"type": ["null", "string"]
11+
},
12+
"browser": {
13+
"type": ["null", "string"]
14+
},
15+
"browser_version": {
16+
"type": ["null", "string"]
17+
},
18+
"city": {
19+
"type": ["null", "string"]
20+
},
21+
"country_code": {
22+
"type": ["null", "string"]
23+
},
24+
"region": {
25+
"type": ["null", "string"]
26+
},
27+
"timezone": {
28+
"type": ["null", "string"]
29+
},
30+
"last_seen": {
31+
"type": ["null", "string"],
32+
"format": "date-time"
33+
},
34+
"email": {
35+
"type": ["null", "string"]
36+
},
37+
"name": {
38+
"type": ["null", "string"]
39+
},
40+
"first_name": {
41+
"type": ["null", "string"]
42+
},
43+
"last_name": {
44+
"type": ["null", "string"]
45+
},
46+
"id": {
47+
"type": ["null", "string"]
48+
},
49+
"unblocked": {
50+
"type": ["null", "string"]
1151
}
1252
}
1353
}

airbyte-integrations/connectors/source-mixpanel/source_mixpanel/schemas/export.json

+3-10
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@
1414
"format": "date-time"
1515
},
1616
"labels": {
17-
"anyOf": [
18-
{
19-
"type": "array",
20-
"items": {
21-
"type": "string"
22-
}
23-
},
24-
{
25-
"type": "null"
17+
"type": ["null", "array"],
18+
"items": {
19+
"type": ["null", "string"]
2620
}
27-
]
2821
},
2922
"sampling_factor": {
3023
"type": ["null", "integer"]

airbyte-integrations/connectors/source-mixpanel/source_mixpanel/schemas/funnels.json

+71-92
Original file line numberDiff line numberDiff line change
@@ -18,113 +18,92 @@
1818
"format": "date-time"
1919
},
2020
"steps": {
21-
"anyOf": [
22-
{
23-
"type": "array",
24-
"items": {
21+
"type": ["null", "array"],
22+
"items": {
23+
"type": ["null", "object"],
24+
"additionalProperties": true,
25+
"properties": {
26+
"count": {
27+
"type": ["null", "integer"]
28+
},
29+
"avg_time": {
30+
"type": ["null", "number"],
31+
"multipleOf": 1e-20
32+
},
33+
"avg_time_from_start": {
34+
"type": ["null", "number"],
35+
"multipleOf": 1e-20
36+
},
37+
"goal": {
38+
"type": ["null", "string"]
39+
},
40+
"overall_conv_ratio": {
41+
"type": ["null", "number"],
42+
"multipleOf": 1e-20
43+
},
44+
"step_conv_ratio": {
45+
"type": ["null", "number"],
46+
"multipleOf": 1e-20
47+
},
48+
"event": {
49+
"type": ["null", "string"]
50+
},
51+
"session_event": {
52+
"type": ["null", "string"]
53+
},
54+
"step_label": {
55+
"type": ["null", "string"]
56+
},
57+
"selector": {
58+
"type": ["null", "string"]
59+
},
60+
"selector_params": {
2561
"type": ["null", "object"],
2662
"additionalProperties": true,
2763
"properties": {
28-
"count": {
29-
"type": ["null", "integer"]
30-
},
31-
"avg_time": {
32-
"type": ["null", "number"],
33-
"multipleOf": 1e-20
34-
},
35-
"avg_time_from_start": {
36-
"type": ["null", "number"],
37-
"multipleOf": 1e-20
38-
},
39-
"goal": {
40-
"type": ["null", "string"]
41-
},
42-
"overall_conv_ratio": {
43-
"type": ["null", "number"],
44-
"multipleOf": 1e-20
45-
},
46-
"step_conv_ratio": {
47-
"type": ["null", "number"],
48-
"multipleOf": 1e-20
49-
},
50-
"event": {
51-
"type": ["null", "string"]
52-
},
53-
"session_event": {
54-
"type": ["null", "string"]
55-
},
5664
"step_label": {
5765
"type": ["null", "string"]
66+
}
67+
}
68+
},
69+
"time_buckets_from_start": {
70+
"type": ["null", "object"],
71+
"additionalProperties": false,
72+
"properties": {
73+
"lower": {
74+
"type": ["null", "integer"]
5875
},
59-
"selector": {
60-
"type": ["null", "string"]
76+
"higher": {
77+
"type": ["null", "integer"]
6178
},
62-
"selector_params": {
63-
"type": ["null", "object"],
64-
"additionalProperties": true,
65-
"properties": {
66-
"step_label": {
67-
"type": ["null", "string"]
68-
}
79+
"buckets": {
80+
"type": ["null", "array"],
81+
"items": {
82+
"type": "integer"
6983
}
84+
}
85+
}
86+
},
87+
"time_buckets_from_prev": {
88+
"type": ["null", "object"],
89+
"additionalProperties": false,
90+
"properties": {
91+
"lower": {
92+
"type": ["null", "integer"]
7093
},
71-
"time_buckets_from_start": {
72-
"type": ["null", "object"],
73-
"additionalProperties": false,
74-
"properties": {
75-
"lower": {
76-
"type": ["null", "integer"]
77-
},
78-
"higher": {
79-
"type": ["null", "integer"]
80-
},
81-
"buckets": {
82-
"anyOf": [
83-
{
84-
"type": "array",
85-
"items": {
86-
"type": "integer"
87-
}
88-
},
89-
{
90-
"type": "null"
91-
}
92-
]
93-
}
94-
}
94+
"higher": {
95+
"type": ["null", "integer"]
9596
},
96-
"time_buckets_from_prev": {
97-
"type": ["null", "object"],
98-
"additionalProperties": false,
99-
"properties": {
100-
"lower": {
101-
"type": ["null", "integer"]
102-
},
103-
"higher": {
104-
"type": ["null", "integer"]
105-
},
106-
"buckets": {
107-
"anyOf": [
108-
{
109-
"type": "array",
110-
"items": {
111-
"type": "integer"
112-
}
113-
},
114-
{
115-
"type": "null"
116-
}
117-
]
118-
}
97+
"buckets": {
98+
"type": ["null", "array"],
99+
"items": {
100+
"type": "integer"
119101
}
120102
}
121103
}
122104
}
123-
},
124-
{
125-
"type": "null"
126105
}
127-
]
106+
}
128107
},
129108
"analysis": {
130109
"type": ["null", "object"],

airbyte-integrations/connectors/source-mixpanel/source_mixpanel/source.py

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from airbyte_cdk.logger import AirbyteLogger
1717
from airbyte_cdk.models import SyncMode
1818
from airbyte_cdk.sources import AbstractSource
19+
from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer
1920
from airbyte_cdk.sources.streams import Stream
2021
from airbyte_cdk.sources.streams.http import HttpStream
2122
from airbyte_cdk.sources.streams.http.auth import HttpAuthenticator, TokenAuthenticator
@@ -401,6 +402,9 @@ class Engage(MixpanelStream):
401402
page_size = 1000 # min 100
402403
_total = None
403404

405+
# enable automatic object mutation to align with desired schema before outputting to the destination
406+
transformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization)
407+
404408
def path(self, **kwargs) -> str:
405409
return "engage"
406410

airbyte-integrations/connectors/source-mixpanel/source_mixpanel/spec.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,39 @@
88
"additionalProperties": true,
99
"properties": {
1010
"api_secret": {
11+
"title": "Api Secret",
1112
"type": "string",
1213
"description": "Mixpanel API Secret. See the <a href=\"https://docs.airbyte.io/integrations/sources/mixpanel\">docs</a> for more information on how to obtain this key.",
1314
"airbyte_secret": true
1415
},
1516
"attribution_window": {
17+
"title": "Attribution Window",
1618
"type": "integer",
1719
"description": "Latency minimum number of days to look-back to account for delays in attributing accurate results. Default attribution window is 5 days.",
1820
"default": 5
1921
},
20-
"date_window_size": {
21-
"type": "integer",
22-
"description": "Number of days for date window looping through transactional endpoints with from_date and to_date. Default date_window_size is 30 days. Clients with large volumes of events may want to decrease this to 14, 7, or even down to 1-2 days.",
23-
"default": 30
24-
},
2522
"project_timezone": {
23+
"title": "Project Timezone",
2624
"type": "string",
2725
"description": "Time zone in which integer date times are stored. The project timezone may be found in the project settings in the Mixpanel console.",
2826
"default": "US/Pacific",
2927
"examples": ["US/Pacific", "UTC"]
3028
},
3129
"select_properties_by_default": {
30+
"title": "Select Properties By Default",
3231
"type": "boolean",
3332
"description": "Setting this config parameter to true ensures that new properties on events and engage records are captured. Otherwise new properties will be ignored",
3433
"default": true
3534
},
3635
"start_date": {
36+
"title": "Start Date",
3737
"type": "string",
3838
"description": "The default value to use if no bookmark exists for an endpoint. If this option is not set, the connector will replicate data from up to one year ago by default.",
3939
"examples": ["2021-11-16"],
4040
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}Z)?$"
4141
},
4242
"region": {
43+
"title": "Region",
4344
"type": "string",
4445
"enum": ["US", "EU"],
4546
"default": "US"

docs/integrations/sources/mixpanel.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ Select the correct region \(EU or US\) for your Mixpanel project. See detail [he
5959

6060
| Version | Date | Pull Request | Subject |
6161
| :--- | :--- | :--- | :--- |
62+
| `0.1.6` | 2021-11-25 | [8256](https://github.com/airbytehq/airbyte/issues/8256) | Deleted `date_window_size` and fix schemas date type issue |
6263
| `0.1.5` | 2021-11-10 | [7451](https://github.com/airbytehq/airbyte/issues/7451) | Support `start_date` older than 1 year |
6364
| `0.1.4` | 2021-11-08 | [7499](https://github.com/airbytehq/airbyte/pull/7499) | Remove base-python dependencies |
6465
| `0.1.3` | 2021-10-30 | [7505](https://github.com/airbytehq/airbyte/issues/7505) | Guarantee that standard and custom mixpanel properties in the `Engage` stream are written as strings |
6566
| `0.1.2` | 2021-11-02 | [7439](https://github.com/airbytehq/airbyte/issues/7439) | Added delay for all streams to match API limitation of requests rate |
6667
| `0.1.1` | 2021-09-16 | [6075](https://github.com/airbytehq/airbyte/issues/6075) | Added option to select project region |
67-
| `0.1.0` | 2021-07-06 | [3698](https://github.com/airbytehq/airbyte/issues/3698) | created CDK native mixpanel connector |
68+
| `0.1.0` | 2021-07-06 | [3698](https://github.com/airbytehq/airbyte/issues/3698) | Created CDK native mixpanel connector |
6869

0 commit comments

Comments
 (0)