Skip to content

Commit

Permalink
[source-tiktok] Remove audience reports hourly streams (#20598)
Browse files Browse the repository at this point in the history
* 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 <octavia-squidington-iii@users.noreply.github.com>
Co-authored-by: Alexandre Girard <alexandre@airbyte.io>
  • Loading branch information
3 people authored Dec 19, 2022
1 parent 27bd807 commit 9f0bfa2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@
- name: TikTok Marketing
sourceDefinitionId: 4bfac00d-ce15-44ff-95b9-9e3c3e8fbd35
dockerRepository: airbyte/source-tiktok-marketing
dockerImageTag: 1.0.0
dockerImageTag: 1.0.1
documentationUrl: https://docs.airbyte.com/integrations/sources/tiktok-marketing
icon: tiktok.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14664,7 +14664,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-tiktok-marketing:1.0.0"
- dockerImage: "airbyte/source-tiktok-marketing:1.0.1"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/tiktok-marketing"
changelogUrl: "https://docs.airbyte.com/integrations/sources/tiktok-marketing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ COPY source_tiktok_marketing ./source_tiktok_marketing
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=1.0.0
LABEL io.airbyte.version=1.0.1
LABEL io.airbyte.name=airbyte/source-tiktok-marketing
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ tests:
discovery:
- config_path: "secrets/prod_config.json"
backward_compatibility_tests_config:
disable_for_version: "0.1.17"
disable_for_version: "1.0.0"
- config_path: "secrets/prod_config_with_day_granularity.json"
backward_compatibility_tests_config:
disable_for_version: "0.1.17"
disable_for_version: "1.0.0"
- config_path: "secrets/prod_config_with_lifetime_granularity.json"
backward_compatibility_tests_config:
disable_for_version: "0.1.17"
disable_for_version: "1.0.0"
- config_path: "secrets/config.json"
backward_compatibility_tests_config:
disable_for_version: "0.1.17"
disable_for_version: "1.0.0"
- config_path: "secrets/new_config_prod.json"
backward_compatibility_tests_config:
disable_for_version: "0.1.17"
disable_for_version: "1.0.0"
- config_path: "secrets/config_oauth.json"
backward_compatibility_tests_config:
disable_for_version: "0.1.17"
disable_for_version: "1.0.0"

basic_read:
# New style streams (for >= 0.1.13):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,6 @@
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
{
"name": "advertisers_audience_reports_hourly",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["stat_time_hour"]
},
{
"name": "advertisers_audience_reports_daily",
"json_schema": {},
Expand All @@ -127,41 +120,20 @@
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
{
"name": "ads_audience_reports_hourly",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["stat_time_hour"]
},
{
"name": "ads_audience_reports_daily",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["stat_time_day"]
},
{
"name": "ad_group_audience_reports_hourly",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["stat_time_hour"]
},
{
"name": "ad_group_audience_reports_daily",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["stat_time_day"]
},
{
"name": "campaigns_audience_reports_by_country_hourly",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["stat_time_hour"]
},
{
"name": "campaigns_audience_reports_by_country_daily",
"json_schema": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,23 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:

# 2. Basic report streams:
reports = [AdsReports, AdGroupsReports, CampaignsReports]
audience_reports = [AdsAudienceReports, AdGroupAudienceReports, CampaignsAudienceReportsByCountry]
if is_production:
# 2.1 streams work only in prod env
reports.extend([AdvertisersReports, AdvertisersAudienceReports])
reports.append(AdvertisersReports)
audience_reports.append(AdvertisersAudienceReports)

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

# 3. Audience report streams:
# Audience report supports lifetime metrics only at the ADVERTISER level (see 2.1).
for Report in [AdsAudienceReports, AdGroupAudienceReports, CampaignsAudienceReportsByCountry]:
for Granularity in [Hourly, Daily]:
streams.append(get_report_stream(Report, Granularity)(**args))
for Report in audience_reports:
# As per TikTok's documentation, audience reports only support daily (not hourly) time dimension for metrics
streams.append(get_report_stream(Report, Daily)(**args))

# Audience report supports lifetime metrics only at the ADVERTISER level (see 2.1).
if Report == AdvertisersAudienceReports:
streams.append(get_report_stream(Report, Lifetime)(**args))

return streams
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def test_random_items(prepared_prod_args):
@pytest.mark.parametrize(
"config, stream_len",
[
(PROD_CONFIG_FILE, 26),
(SANDBOX_CONFIG_FILE, 19),
(PROD_CONFIG_FILE, 22),
(SANDBOX_CONFIG_FILE, 16),
],
)
def test_source_streams(config, stream_len):
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/tiktok-marketing.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ The connector is restricted by [requests limitation](https://ads.tiktok.com/mark

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:----------------------------------------------------------------------------------------------|
| 1.0.1 | 2022-12-16 | [20598](https://github.com/airbytehq/airbyte/pull/20598) | Remove Audience Reports with Hourly granularity due to deprecated dimension. |
| 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. |
| 0.1.17 | 2022-10-04 | [17557](https://github.com/airbytehq/airbyte/pull/17557) | Retry error 50002 |
| 0.1.16 | 2022-09-28 | [17326](https://github.com/airbytehq/airbyte/pull/17326) | Migrate to per-stream state |
Expand Down

0 comments on commit 9f0bfa2

Please sign in to comment.