From d19cbefae11cde9733955ad5f14ebf73b2592be2 Mon Sep 17 00:00:00 2001 From: drrest Date: Mon, 27 Jun 2022 15:44:56 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20Source=20BingAds:=20=20expose=20?= =?UTF-8?q?hourly/daily/weekly/monthly=20options=20from=20configuration=20?= =?UTF-8?q?(#13801)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #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 --- .../resources/seed/source_definitions.yaml | 2 +- .../src/main/resources/seed/source_specs.yaml | 38 +------------------ .../connectors/source-bing-ads/Dockerfile | 2 +- .../connectors/source-bing-ads/bootstrap.md | 2 +- .../source-bing-ads/source_bing_ads/client.py | 8 ---- .../source-bing-ads/source_bing_ads/source.py | 17 +++------ .../source-bing-ads/source_bing_ads/spec.json | 30 +-------------- .../source-bing-ads/unit_tests/test_source.py | 8 +--- docs/integrations/sources/bing-ads.md | 23 +++++------ 9 files changed, 24 insertions(+), 106 deletions(-) diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index 50c322659fb6..9dc7b71723cb 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -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 diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index 0128ed9eeaed..ac562759883a 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -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: @@ -880,10 +880,6 @@ - "client_id" - "refresh_token" - "reports_start_date" - - "hourly_reports" - - "daily_reports" - - "weekly_reports" - - "monthly_reports" additionalProperties: true properties: auth_method: @@ -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 the docs." - 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 the docs." - 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 the docs." - 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 the docs." - default: false supportsNormalization: false supportsDBT: false supported_destination_sync_modes: [] diff --git a/airbyte-integrations/connectors/source-bing-ads/Dockerfile b/airbyte-integrations/connectors/source-bing-ads/Dockerfile index 683c8ee29044..9a5b1791d115 100644 --- a/airbyte-integrations/connectors/source-bing-ads/Dockerfile +++ b/airbyte-integrations/connectors/source-bing-ads/Dockerfile @@ -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 diff --git a/airbyte-integrations/connectors/source-bing-ads/bootstrap.md b/airbyte-integrations/connectors/source-bing-ads/bootstrap.md index 12f1d8862494..7dc3b750d3b2 100644 --- a/airbyte-integrations/connectors/source-bing-ads/bootstrap.md +++ b/airbyte-integrations/connectors/source-bing-ads/bootstrap.md @@ -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 diff --git a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/client.py b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/client.py index adee0c764964..e1b13afec54c 100644 --- a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/client.py +++ b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/client.py @@ -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, @@ -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 diff --git a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/source.py b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/source.py index 424734f013c6..ca977c46d07a 100644 --- a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/source.py +++ b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/source.py @@ -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 diff --git a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/spec.json b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/spec.json index c6c847e87703..7807377f8d14 100644 --- a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/spec.json +++ b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/spec.json @@ -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": { @@ -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 the docs.", - "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 the docs.", - "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 the docs.", - "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 the docs.", - "default": false } } }, diff --git a/airbyte-integrations/connectors/source-bing-ads/unit_tests/test_source.py b/airbyte-integrations/connectors/source-bing-ads/unit_tests/test_source.py index 7871efbbd8be..f6a0e0dbb081 100644 --- a/airbyte-integrations/connectors/source-bing-ads/unit_tests/test_source.py +++ b/airbyte-integrations/connectors/source-bing-ads/unit_tests/test_source.py @@ -3,7 +3,7 @@ # import json -from unittest.mock import MagicMock, patch +from unittest.mock import patch import pytest import source_bing_ads @@ -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 diff --git a/docs/integrations/sources/bing-ads.md b/docs/integrations/sources/bing-ads.md index 5eb509dab214..f9e8b609e030 100644 --- a/docs/integrations/sources/bing-ads.md +++ b/docs/integrations/sources/bing-ads.md @@ -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:** @@ -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\) |