Skip to content

Commit 9f0bfa2

Browse files
brianjlaioctavia-squidington-iiigirarda
authored
[source-tiktok] Remove audience reports hourly streams (#20598)
* get rid of audience report streams using hourly dimension * bump version and docs changelog * fix tests * update backwards compatibility tests since some streams are no longer available * auto-bump connector version Co-authored-by: Octavia Squidington III <[email protected]> Co-authored-by: Alexandre Girard <[email protected]>
1 parent 27bd807 commit 9f0bfa2

File tree

8 files changed

+22
-44
lines changed

8 files changed

+22
-44
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@
16371637
- name: TikTok Marketing
16381638
sourceDefinitionId: 4bfac00d-ce15-44ff-95b9-9e3c3e8fbd35
16391639
dockerRepository: airbyte/source-tiktok-marketing
1640-
dockerImageTag: 1.0.0
1640+
dockerImageTag: 1.0.1
16411641
documentationUrl: https://docs.airbyte.com/integrations/sources/tiktok-marketing
16421642
icon: tiktok.svg
16431643
sourceType: api

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14664,7 +14664,7 @@
1466414664
supportsNormalization: false
1466514665
supportsDBT: false
1466614666
supported_destination_sync_modes: []
14667-
- dockerImage: "airbyte/source-tiktok-marketing:1.0.0"
14667+
- dockerImage: "airbyte/source-tiktok-marketing:1.0.1"
1466814668
spec:
1466914669
documentationUrl: "https://docs.airbyte.com/integrations/sources/tiktok-marketing"
1467014670
changelogUrl: "https://docs.airbyte.com/integrations/sources/tiktok-marketing"

airbyte-integrations/connectors/source-tiktok-marketing/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ COPY source_tiktok_marketing ./source_tiktok_marketing
3232
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
3333
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
3434

35-
LABEL io.airbyte.version=1.0.0
35+
LABEL io.airbyte.version=1.0.1
3636
LABEL io.airbyte.name=airbyte/source-tiktok-marketing

airbyte-integrations/connectors/source-tiktok-marketing/acceptance-test-config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ tests:
2828
discovery:
2929
- config_path: "secrets/prod_config.json"
3030
backward_compatibility_tests_config:
31-
disable_for_version: "0.1.17"
31+
disable_for_version: "1.0.0"
3232
- config_path: "secrets/prod_config_with_day_granularity.json"
3333
backward_compatibility_tests_config:
34-
disable_for_version: "0.1.17"
34+
disable_for_version: "1.0.0"
3535
- config_path: "secrets/prod_config_with_lifetime_granularity.json"
3636
backward_compatibility_tests_config:
37-
disable_for_version: "0.1.17"
37+
disable_for_version: "1.0.0"
3838
- config_path: "secrets/config.json"
3939
backward_compatibility_tests_config:
40-
disable_for_version: "0.1.17"
40+
disable_for_version: "1.0.0"
4141
- config_path: "secrets/new_config_prod.json"
4242
backward_compatibility_tests_config:
43-
disable_for_version: "0.1.17"
43+
disable_for_version: "1.0.0"
4444
- config_path: "secrets/config_oauth.json"
4545
backward_compatibility_tests_config:
46-
disable_for_version: "0.1.17"
46+
disable_for_version: "1.0.0"
4747

4848
basic_read:
4949
# New style streams (for >= 0.1.13):

airbyte-integrations/connectors/source-tiktok-marketing/integration_tests/streams.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,6 @@
108108
"json_schema": {},
109109
"supported_sync_modes": ["full_refresh"]
110110
},
111-
{
112-
"name": "advertisers_audience_reports_hourly",
113-
"json_schema": {},
114-
"supported_sync_modes": ["full_refresh", "incremental"],
115-
"source_defined_cursor": true,
116-
"default_cursor_field": ["stat_time_hour"]
117-
},
118111
{
119112
"name": "advertisers_audience_reports_daily",
120113
"json_schema": {},
@@ -127,41 +120,20 @@
127120
"json_schema": {},
128121
"supported_sync_modes": ["full_refresh"]
129122
},
130-
{
131-
"name": "ads_audience_reports_hourly",
132-
"json_schema": {},
133-
"supported_sync_modes": ["full_refresh", "incremental"],
134-
"source_defined_cursor": true,
135-
"default_cursor_field": ["stat_time_hour"]
136-
},
137123
{
138124
"name": "ads_audience_reports_daily",
139125
"json_schema": {},
140126
"supported_sync_modes": ["full_refresh", "incremental"],
141127
"source_defined_cursor": true,
142128
"default_cursor_field": ["stat_time_day"]
143129
},
144-
{
145-
"name": "ad_group_audience_reports_hourly",
146-
"json_schema": {},
147-
"supported_sync_modes": ["full_refresh", "incremental"],
148-
"source_defined_cursor": true,
149-
"default_cursor_field": ["stat_time_hour"]
150-
},
151130
{
152131
"name": "ad_group_audience_reports_daily",
153132
"json_schema": {},
154133
"supported_sync_modes": ["full_refresh", "incremental"],
155134
"source_defined_cursor": true,
156135
"default_cursor_field": ["stat_time_day"]
157136
},
158-
{
159-
"name": "campaigns_audience_reports_by_country_hourly",
160-
"json_schema": {},
161-
"supported_sync_modes": ["full_refresh", "incremental"],
162-
"source_defined_cursor": true,
163-
"default_cursor_field": ["stat_time_hour"]
164-
},
165137
{
166138
"name": "campaigns_audience_reports_by_country_daily",
167139
"json_schema": {},

airbyte-integrations/connectors/source-tiktok-marketing/source_tiktok_marketing/source.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,23 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
158158

159159
# 2. Basic report streams:
160160
reports = [AdsReports, AdGroupsReports, CampaignsReports]
161+
audience_reports = [AdsAudienceReports, AdGroupAudienceReports, CampaignsAudienceReportsByCountry]
161162
if is_production:
162163
# 2.1 streams work only in prod env
163-
reports.extend([AdvertisersReports, AdvertisersAudienceReports])
164+
reports.append(AdvertisersReports)
165+
audience_reports.append(AdvertisersAudienceReports)
164166

165167
for Report in reports:
166168
for Granularity in [Hourly, Daily, Lifetime]:
167169
streams.append(get_report_stream(Report, Granularity)(**args))
168170

169171
# 3. Audience report streams:
170-
# Audience report supports lifetime metrics only at the ADVERTISER level (see 2.1).
171-
for Report in [AdsAudienceReports, AdGroupAudienceReports, CampaignsAudienceReportsByCountry]:
172-
for Granularity in [Hourly, Daily]:
173-
streams.append(get_report_stream(Report, Granularity)(**args))
172+
for Report in audience_reports:
173+
# As per TikTok's documentation, audience reports only support daily (not hourly) time dimension for metrics
174+
streams.append(get_report_stream(Report, Daily)(**args))
175+
176+
# Audience report supports lifetime metrics only at the ADVERTISER level (see 2.1).
177+
if Report == AdvertisersAudienceReports:
178+
streams.append(get_report_stream(Report, Lifetime)(**args))
174179

175180
return streams

airbyte-integrations/connectors/source-tiktok-marketing/unit_tests/unit_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def test_random_items(prepared_prod_args):
134134
@pytest.mark.parametrize(
135135
"config, stream_len",
136136
[
137-
(PROD_CONFIG_FILE, 26),
138-
(SANDBOX_CONFIG_FILE, 19),
137+
(PROD_CONFIG_FILE, 22),
138+
(SANDBOX_CONFIG_FILE, 16),
139139
],
140140
)
141141
def test_source_streams(config, stream_len):

docs/integrations/sources/tiktok-marketing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ The connector is restricted by [requests limitation](https://ads.tiktok.com/mark
550550

551551
| Version | Date | Pull Request | Subject |
552552
|:--------|:-----------|:---------------------------------------------------------|:----------------------------------------------------------------------------------------------|
553+
| 1.0.1 | 2022-12-16 | [20598](https://github.com/airbytehq/airbyte/pull/20598) | Remove Audience Reports with Hourly granularity due to deprecated dimension. |
553554
| 1.0.0 | 2022-12-05 | [19758](https://github.com/airbytehq/airbyte/pull/19758) | Convert `mobile_app_id` from integer to string in AudienceReport streams. |
554555
| 0.1.17 | 2022-10-04 | [17557](https://github.com/airbytehq/airbyte/pull/17557) | Retry error 50002 |
555556
| 0.1.16 | 2022-09-28 | [17326](https://github.com/airbytehq/airbyte/pull/17326) | Migrate to per-stream state |

0 commit comments

Comments
 (0)