Skip to content

Commit

Permalink
🎉 Source BingAds: expose hourly/daily/weekly/monthly options from con…
Browse files Browse the repository at this point in the history
…figuration (#13801)

* #12489 - expose hourly/daily/weekly/monthly reports in discovery by default instead of in the connector's configuration settings

removed:  config settings for hourly/daily/weekly/monthly reports
added:    default value for all periodic reports to True

* #12489 - expose hourly/daily/weekly/monthly reports in discovery by default instead of in the connector's configuration settings

removed:  unused class variables, if-statement

* #12489 - expose hourly/daily/weekly/monthly reports in discovery by default instead of in the connector's configuration settings

removed:  unused variables from config

* auto-bump connector version

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
  • Loading branch information
drrest and octavia-squidington-iii authored Jun 27, 2022
1 parent 501a1c3 commit d19cbef
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
- name: Bing Ads
sourceDefinitionId: 47f25999-dd5e-4636-8c39-e7cea2453331
dockerRepository: airbyte/source-bing-ads
dockerImageTag: 0.1.7
dockerImageTag: 0.1.8
documentationUrl: https://docs.airbyte.io/integrations/sources/bing-ads
icon: bingads.svg
sourceType: api
Expand Down
38 changes: 1 addition & 37 deletions airbyte-config/init/src/main/resources/seed/source_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@
- "overwrite"
- "append"
- "append_dedup"
- dockerImage: "airbyte/source-bing-ads:0.1.7"
- dockerImage: "airbyte/source-bing-ads:0.1.8"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/bing-ads"
connectionSpecification:
Expand All @@ -880,10 +880,6 @@
- "client_id"
- "refresh_token"
- "reports_start_date"
- "hourly_reports"
- "daily_reports"
- "weekly_reports"
- "monthly_reports"
additionalProperties: true
properties:
auth_method:
Expand Down Expand Up @@ -934,38 +930,6 @@
\ Any data generated before this date will not be replicated in reports.\
\ This is a UTC date in YYYY-MM-DD format."
order: 5
hourly_reports:
title: "Enable hourly-aggregate reports"
type: "boolean"
description: "Toggle this to enable replicating reports aggregated using\
\ an hourly time window. More information about report aggregation can\
\ be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\"\
>the docs</a>."
default: false
daily_reports:
title: "Enable daily-aggregate reports"
type: "boolean"
description: "Toggle this to enable replicating reports aggregated using\
\ a daily time window. More information about report aggregation can be\
\ found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\"\
>the docs</a>."
default: false
weekly_reports:
title: "Enable weekly-aggregate reports"
type: "boolean"
description: "Toggle this to enable replicating reports aggregated using\
\ a weekly time window running from Sunday to Saturday. More information\
\ about report aggregation can be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\"\
>the docs</a>."
default: false
monthly_reports:
title: "Enable monthly-aggregate reports"
type: "boolean"
description: "Toggle this to enable replicating reports aggregated using\
\ a monthly time window. More information about report aggregation can\
\ be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\"\
>the docs</a>."
default: false
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-bing-ads/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.7
LABEL io.airbyte.version=0.1.8
LABEL io.airbyte.name=airbyte/source-bing-ads
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Initially all fields in report streams have string values, connector uses `repor

Connector uses `reports_start_date` config for initial reports sync and current date as an end data.

Connector has `hourly_reports`, `daily_reports`, `weekly_reports`, `monthly_reports` configs which allows to enable appropriate report streams. For example `account_performance_report_daily`, `ad_group_performance_report_daily` etc ... By default all report streams are disabled
Connector has `hourly_reports`, `daily_reports`, `weekly_reports`, `monthly_reports` report streams. For example `account_performance_report_daily`, `ad_group_performance_report_weekly`. All these reports streams will be generated on execute.

## Request caching

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def __init__(
self,
tenant_id: str,
reports_start_date: str,
hourly_reports: bool,
daily_reports: bool,
weekly_reports: bool,
monthly_reports: bool,
developer_token: str = None,
client_id: str = None,
client_secret: str = None,
Expand All @@ -51,10 +47,6 @@ def __init__(
self.authorization_data: Mapping[str, AuthorizationData] = {}
self.refresh_token = refresh_token
self.developer_token = developer_token
self.hourly_reports = hourly_reports
self.daily_reports = daily_reports
self.weekly_reports = weekly_reports
self.monthly_reports = monthly_reports

self.client_id = client_id
self.client_secret = client_secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,16 +597,11 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
Campaigns(client, config),
]

if config["hourly_reports"] or config["daily_reports"] or config["weekly_reports"] or config["monthly_reports"]:
streams.append(BudgetSummaryReport(client, config))

if config["hourly_reports"]:
streams.extend([c(client, config) for c in self.get_report_streams("Hourly")])
if config["daily_reports"]:
streams.extend([c(client, config) for c in self.get_report_streams("Daily")])
if config["weekly_reports"]:
streams.extend([c(client, config) for c in self.get_report_streams("Weekly")])
if config["monthly_reports"]:
streams.extend([c(client, config) for c in self.get_report_streams("Monthly")])
streams.append(BudgetSummaryReport(client, config))

streams.extend([c(client, config) for c in self.get_report_streams("Hourly")])
streams.extend([c(client, config) for c in self.get_report_streams("Daily")])
streams.extend([c(client, config) for c in self.get_report_streams("Weekly")])
streams.extend([c(client, config) for c in self.get_report_streams("Monthly")])

return streams
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
"developer_token",
"client_id",
"refresh_token",
"reports_start_date",
"hourly_reports",
"daily_reports",
"weekly_reports",
"monthly_reports"
"reports_start_date"
],
"additionalProperties": true,
"properties": {
Expand Down Expand Up @@ -64,30 +60,6 @@
"default": "2020-01-01",
"description": "The start date from which to begin replicating report data. Any data generated before this date will not be replicated in reports. This is a UTC date in YYYY-MM-DD format.",
"order": 5
},
"hourly_reports": {
"title": "Enable hourly-aggregate reports",
"type": "boolean",
"description": "Toggle this to enable replicating reports aggregated using an hourly time window. More information about report aggregation can be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\">the docs</a>.",
"default": false
},
"daily_reports": {
"title": "Enable daily-aggregate reports",
"type": "boolean",
"description": "Toggle this to enable replicating reports aggregated using a daily time window. More information about report aggregation can be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\">the docs</a>.",
"default": false
},
"weekly_reports": {
"title": "Enable weekly-aggregate reports",
"type": "boolean",
"description": "Toggle this to enable replicating reports aggregated using a weekly time window running from Sunday to Saturday. More information about report aggregation can be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\">the docs</a>.",
"default": false
},
"monthly_reports": {
"title": "Enable monthly-aggregate reports",
"type": "boolean",
"description": "Toggle this to enable replicating reports aggregated using a monthly time window. More information about report aggregation can be found in <a href=\"https://docs.airbyte.com/integrations/sources/bing-ads/#report-aggregation\">the docs</a>.",
"default": false
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

import json
from unittest.mock import MagicMock, patch
from unittest.mock import patch

import pytest
import source_bing_ads
Expand All @@ -28,12 +28,6 @@ def logger_mock_fixture():
@patch.object(source_bing_ads.source, "Client")
def test_streams_config_based(mocked_client, config):
streams = SourceBingAds().streams(config)
assert len(streams) == 15


@patch.object(source_bing_ads.source, "Client")
def test_streams_all(mocked_client):
streams = SourceBingAds().streams(MagicMock())
assert len(streams) == 25


Expand Down
23 changes: 12 additions & 11 deletions docs/integrations/sources/bing-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This page guides you through the process of setting up the Bing Ads source conne
4. Add Tenant ID
5. Click `Authenticate your account`.
6. Log in and Authorize to the BingAds account
7. Choose required Start date and type of aggregation report
7. Choose required Start date
8. click `Set up source`.

**For Airbyte OSS:**
Expand Down Expand Up @@ -96,14 +96,15 @@ API limits number of requests for all Microsoft Advertising clients. You can fin

## Changelog

| Version | Date | Pull Request | Subject |
|:--------| :--- |:---------------------------------------------------------| :--- |
| 0.1.7 | 2022-05-17 | [12937](https://github.com/airbytehq/airbyte/pull/12937) | Added OAuth2.0 authentication method, removed `redirect_uri` from input configuration
| 0.1.6 | 2022-04-30 | [12500](https://github.com/airbytehq/airbyte/pull/12500) | Improve input configuration copy |
| 0.1.5 | 2022-01-01 | [11652](https://github.com/airbytehq/airbyte/pull/11652) | Rebump attempt after DockerHub failure at registring the 0.1.4 |
| 0.1.4 | 2022-03-22 | [11311](https://github.com/airbytehq/airbyte/pull/11311) | Added optional Redirect URI & Tenant ID to spec |
| 0.1.3 | 2022-01-14 | [9510](https://github.com/airbytehq/airbyte/pull/9510) | Fixed broken dependency that blocked connector's operations |
| 0.1.2 | 2021-12-14 | [8429](https://github.com/airbytehq/airbyte/pull/8429) | Update titles and descriptions |
| 0.1.1 | 2021-08-31 | [5750](https://github.com/airbytehq/airbyte/pull/5750) | Added reporting streams\) |
| 0.1.0 | 2021-07-22 | [4911](https://github.com/airbytehq/airbyte/pull/4911) | Initial release supported core streams \(Accounts, Campaigns, Ads, AdGroups\) |
| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------|
| 0.1.8 | 2022-06-15 | [13801](https://github.com/airbytehq/airbyte/pull/13801) | All reports `hourly/daily/weekly/monthly` will be generated by default, these options are removed from input configuration |
| 0.1.7 | 2022-05-17 | [12937](https://github.com/airbytehq/airbyte/pull/12937) | Added OAuth2.0 authentication method, removed `redirect_uri` from input configuration |
| 0.1.6 | 2022-04-30 | [12500](https://github.com/airbytehq/airbyte/pull/12500) | Improve input configuration copy |
| 0.1.5 | 2022-01-01 | [11652](https://github.com/airbytehq/airbyte/pull/11652) | Rebump attempt after DockerHub failure at registring the 0.1.4 |
| 0.1.4 | 2022-03-22 | [11311](https://github.com/airbytehq/airbyte/pull/11311) | Added optional Redirect URI & Tenant ID to spec |
| 0.1.3 | 2022-01-14 | [9510](https://github.com/airbytehq/airbyte/pull/9510) | Fixed broken dependency that blocked connector's operations |
| 0.1.2 | 2021-12-14 | [8429](https://github.com/airbytehq/airbyte/pull/8429) | Update titles and descriptions |
| 0.1.1 | 2021-08-31 | [5750](https://github.com/airbytehq/airbyte/pull/5750) | Added reporting streams\) |
| 0.1.0 | 2021-07-22 | [4911](https://github.com/airbytehq/airbyte/pull/4911) | Initial release supported core streams \(Accounts, Campaigns, Ads, AdGroups\) |

0 comments on commit d19cbef

Please sign in to comment.