From 03c6c05159388455d20ecb8d57b8f2092e0fbd3e Mon Sep 17 00:00:00 2001 From: Daryna Ishchenko Date: Tue, 31 Oct 2023 18:15:56 +0200 Subject: [PATCH 1/4] add new stream Keywords --- .../integration_tests/configured_catalog.json | 10 ++ .../integration_tests/expected_records.jsonl | 3 + .../connectors/source-bing-ads/metadata.yaml | 2 +- .../source_bing_ads/schemas/keywords.json | 102 ++++++++++++++++++ .../source-bing-ads/source_bing_ads/source.py | 2 + .../source_bing_ads/streams.py | 11 ++ docs/integrations/sources/bing-ads.md | 1 + 7 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json diff --git a/airbyte-integrations/connectors/source-bing-ads/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-bing-ads/integration_tests/configured_catalog.json index 426ddd6136818..3abd2a9a3845b 100644 --- a/airbyte-integrations/connectors/source-bing-ads/integration_tests/configured_catalog.json +++ b/airbyte-integrations/connectors/source-bing-ads/integration_tests/configured_catalog.json @@ -485,6 +485,16 @@ "sync_mode": "incremental", "cursor_field": ["TimePeriod"], "destination_sync_mode": "append" + }, + { + "stream": { + "name": "keywords", + "json_schema": {}, + "supported_sync_modes": ["incremental", "full_refresh"] + }, + "sync_mode": "incremental", + "cursor_field": ["TimePeriod"], + "destination_sync_mode": "append" } ] } diff --git a/airbyte-integrations/connectors/source-bing-ads/integration_tests/expected_records.jsonl b/airbyte-integrations/connectors/source-bing-ads/integration_tests/expected_records.jsonl index d55e69dfb2058..b51de3b2f924b 100644 --- a/airbyte-integrations/connectors/source-bing-ads/integration_tests/expected_records.jsonl +++ b/airbyte-integrations/connectors/source-bing-ads/integration_tests/expected_records.jsonl @@ -38,3 +38,6 @@ {"stream":"campaign_labels","data":{"Status":"Active","Id":10239203506494,"Parent Id":413444833,"Campaign":null,"Client Id":null,"Modified Time":"04/27/2023 17:57:38.110","Account Id":180278106},"emitted_at":1698687214960} {"stream":"keyword_labels","data":{"Status":"Active","Id":10239203506495,"Parent Id":84868925026027,"Client Id":null,"Modified Time":"04/27/2023 17:22:52.733","Account Id":180278106},"emitted_at":1698687224964} {"stream":"ad_group_labels","data":{"Status":"Active","Id":10239203506494,"Parent Id":1350201453189474,"Campaign":null,"Ad Group":null,"Client Id":null,"Modified Time":"04/27/2023 18:00:14.970","Account Id":180278106},"emitted_at":1698751388918} +{"stream": "keywords", "data": {"Status": "Active", "Id": 84525593559627, "Parent Id": "1352400325389092", "Campaign": "Test 2", "Ad Group": "Airbyte", "Client Id": null, "Modified Time": "08/13/2021 02:33:08.560", "Tracking Template": null, "Final Url Suffix": null, "Custom Parameter": null, "Final Url": null, "Mobile Final Url": null, "Bid Strategy Type": "InheritFromParent", "Inherited Bid Strategy Type": "MaxClicks", "Destination Url": null, "Editorial Status": "Active", "Editorial Location": null, "Editorial Term": null, "Editorial Reason Code": null, "Editorial Appeal Status": null, "Keyword": "big data integration tools", "Match Type": "Broad", "Bid": "0.11", "Param1": null, "Param2": null, "Param3": null, "Publisher Countries": null, "Quality Score": null, "Keyword Relevance": null, "Landing Page Relevance": null, "Landing Page User Experience": null, "Account Id": 180278106}, "emitted_at": 1698768109942} +{"stream": "keywords", "data": {"Status": "Active", "Id": 84525593559628, "Parent Id": "1352400325389092", "Campaign": "Test 2", "Ad Group": "Airbyte", "Client Id": null, "Modified Time": "08/13/2021 02:33:14.270", "Tracking Template": null, "Final Url Suffix": null, "Custom Parameter": null, "Final Url": null, "Mobile Final Url": null, "Bid Strategy Type": "InheritFromParent", "Inherited Bid Strategy Type": "MaxClicks", "Destination Url": null, "Editorial Status": "Active", "Editorial Location": null, "Editorial Term": null, "Editorial Reason Code": null, "Editorial Appeal Status": null, "Keyword": "best data integration tool", "Match Type": "Broad", "Bid": "0.11", "Param1": null, "Param2": null, "Param3": null, "Publisher Countries": null, "Quality Score": null, "Keyword Relevance": null, "Landing Page Relevance": null, "Landing Page User Experience": null, "Account Id": 180278106}, "emitted_at": 1698768109942} +{"stream": "keywords", "data": {"Status": "Active", "Id": 84525593559629, "Parent Id": "1352400325389092", "Campaign": "Test 2", "Ad Group": "Airbyte", "Client Id": null, "Modified Time": "08/13/2021 02:33:19.053", "Tracking Template": null, "Final Url Suffix": null, "Custom Parameter": null, "Final Url": null, "Mobile Final Url": null, "Bid Strategy Type": "InheritFromParent", "Inherited Bid Strategy Type": "MaxClicks", "Destination Url": null, "Editorial Status": "Active", "Editorial Location": null, "Editorial Term": null, "Editorial Reason Code": null, "Editorial Appeal Status": null, "Keyword": "data integration tools", "Match Type": "Broad", "Bid": "0.11", "Param1": null, "Param2": null, "Param3": null, "Publisher Countries": null, "Quality Score": null, "Keyword Relevance": null, "Landing Page Relevance": null, "Landing Page User Experience": null, "Account Id": 180278106}, "emitted_at": 1698768109943} diff --git a/airbyte-integrations/connectors/source-bing-ads/metadata.yaml b/airbyte-integrations/connectors/source-bing-ads/metadata.yaml index c158a2afd5adb..b45dcc52e5b94 100644 --- a/airbyte-integrations/connectors/source-bing-ads/metadata.yaml +++ b/airbyte-integrations/connectors/source-bing-ads/metadata.yaml @@ -16,7 +16,7 @@ data: connectorSubtype: api connectorType: source definitionId: 47f25999-dd5e-4636-8c39-e7cea2453331 - dockerImageTag: 1.5.0 + dockerImageTag: 1.6.0 dockerRepository: airbyte/source-bing-ads documentationUrl: https://docs.airbyte.com/integrations/sources/bing-ads githubIssueLabel: source-bing-ads diff --git a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json new file mode 100644 index 0000000000000..5aaaa9e0c53b4 --- /dev/null +++ b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json @@ -0,0 +1,102 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Account Id": { + "type": ["null", "integer"] + }, + "Id": { + "type": ["null", "integer"] + }, + "Ad Group": { + "type": ["null", "string"] + }, + "Bid": { + "type": ["null", "string"] + }, + "Bid Strategy Type": { + "type": ["null", "string"] + }, + "Campaign": { + "type": ["null", "string"] + }, + "Client Id": { + "type": ["null", "integer"] + }, + "Custom Parameter": { + "type": ["null", "string"] + }, + "Destination Url": { + "type": ["null", "string"] + }, + "Modified Time": { + "type": ["null", "string"] + }, + "Editorial Appeal Status": { + "type": ["null", "string"] + }, + "Editorial Location": { + "type": ["null", "string"] + }, + "Editorial Reason Code": { + "type": ["null", "string"] + }, + "Editorial Status": { + "type": ["null", "string"] + }, + "Editorial Term": { + "type": ["null", "string"] + }, + "Final Url": { + "type": ["null", "string"] + }, + "Final Url Suffix": { + "type": ["null", "string"] + }, + "Inherited Bid Strategy Type": { + "type": ["null", "string"] + }, + "Keyword": { + "type": ["null", "string"] + }, + "Keyword Relevance": { + "type": ["null", "string"] + }, + "Landing Page Relevance": { + "type": ["null", "string"] + }, + "Landing Page User Experience": { + "type": ["null", "string"] + }, + "Match Type": { + "type": ["null", "string"] + }, + "Mobile Final Url": { + "type": ["null", "string"] + }, + "Param1": { + "type": ["null", "string"] + }, + "Param2": { + "type": ["null", "string"] + }, + "Param3": { + "type": ["null", "string"] + }, + "Parent Id": { + "type": ["null", "string"] + }, + "Publisher Countries": { + "type": ["null", "string"] + }, + "Quality Score": { + "type": ["null", "string"] + }, + "Status": { + "type": ["null", "string"] + }, + "Tracking Template": { + "type": ["null", "string"] + } + } +} 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 904885e366d5c..1246ac8bcea67 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 @@ -47,6 +47,7 @@ GeographicPerformanceReportHourly, GeographicPerformanceReportMonthly, GeographicPerformanceReportWeekly, + Keywords, KeywordLabels, KeywordPerformanceReportDaily, KeywordPerformanceReportHourly, @@ -93,6 +94,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: BudgetSummaryReport(client, config), Labels(client, config), KeywordLabels(client, config), + Keywords(client, config), CampaignLabels(client, config), ] diff --git a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/streams.py b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/streams.py index 0ee6c5cd20260..2aaa774c0d45e 100644 --- a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/streams.py +++ b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/streams.py @@ -298,6 +298,17 @@ class KeywordLabels(BingAdsBulkStream): primary_key = "Id" +class Keywords(BingAdsBulkStream): + """ + https://learn.microsoft.com/en-us/advertising/bulk-service/keyword-label?view=bingads-13 + """ + + data_scope = ["EntityData"] + download_entities = ["Keywords"] + + primary_key = "Id" + + class CampaignLabels(BingAdsBulkStream): """ https://learn.microsoft.com/en-us/advertising/bulk-service/campaign-label?view=bingads-13 diff --git a/docs/integrations/sources/bing-ads.md b/docs/integrations/sources/bing-ads.md index 20d8dc01f654d..8bca1184c9c3e 100644 --- a/docs/integrations/sources/bing-ads.md +++ b/docs/integrations/sources/bing-ads.md @@ -141,6 +141,7 @@ The Bing Ads API limits the number of requests for all Microsoft Advertising cli | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------| +| 1.6.0 | 2023-10-31 | | Add new streams `Keywords` | | 1.5.0 | 2023-10-30 | [31952](https://github.com/airbytehq/airbyte/pull/31952) | Add new streams `Labels`, `App install ads`, `Keyword Labels`, `Campaign Labels`, `App Install Ad Labels`, `Ad Group Labels` | | 1.4.0 | 2023-10-27 | [31885](https://github.com/airbytehq/airbyte/pull/31885) | Add new stream: `AccountImpressionPerformanceReport` (daily, hourly, weekly, monthly) | | 1.3.0 | 2023-10-26 | [31837](https://github.com/airbytehq/airbyte/pull/31837) | Add new stream: `UserLocationPerformanceReport` (daily, hourly, weekly, monthly) | From 46fcd50d769b3870b6f92976dd597fea6b619919 Mon Sep 17 00:00:00 2001 From: Daryna Ishchenko Date: Tue, 31 Oct 2023 18:21:03 +0200 Subject: [PATCH 2/4] updated changelog --- docs/integrations/sources/bing-ads.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/sources/bing-ads.md b/docs/integrations/sources/bing-ads.md index 8bca1184c9c3e..d0c3b70c1e3e3 100644 --- a/docs/integrations/sources/bing-ads.md +++ b/docs/integrations/sources/bing-ads.md @@ -141,7 +141,7 @@ The Bing Ads API limits the number of requests for all Microsoft Advertising cli | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------| -| 1.6.0 | 2023-10-31 | | Add new streams `Keywords` | +| 1.6.0 | 2023-10-31 | [32008](https://github.com/airbytehq/airbyte/pull/32008) | Add new streams `Keywords` | | 1.5.0 | 2023-10-30 | [31952](https://github.com/airbytehq/airbyte/pull/31952) | Add new streams `Labels`, `App install ads`, `Keyword Labels`, `Campaign Labels`, `App Install Ad Labels`, `Ad Group Labels` | | 1.4.0 | 2023-10-27 | [31885](https://github.com/airbytehq/airbyte/pull/31885) | Add new stream: `AccountImpressionPerformanceReport` (daily, hourly, weekly, monthly) | | 1.3.0 | 2023-10-26 | [31837](https://github.com/airbytehq/airbyte/pull/31837) | Add new stream: `UserLocationPerformanceReport` (daily, hourly, weekly, monthly) | From c46004232fb84ba7bd54ad1a93bab7255a0f280f Mon Sep 17 00:00:00 2001 From: darynaishchenko Date: Tue, 31 Oct 2023 16:50:08 +0000 Subject: [PATCH 3/4] Automated Commit - Formatting Changes --- .../source-bing-ads/source_bing_ads/schemas/keywords.json | 2 +- .../connectors/source-bing-ads/source_bing_ads/source.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json index 5aaaa9e0c53b4..9987fe828be26 100644 --- a/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json +++ b/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/schemas/keywords.json @@ -79,7 +79,7 @@ }, "Param2": { "type": ["null", "string"] - }, + }, "Param3": { "type": ["null", "string"] }, 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 1246ac8bcea67..998f283813a00 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 @@ -47,12 +47,12 @@ GeographicPerformanceReportHourly, GeographicPerformanceReportMonthly, GeographicPerformanceReportWeekly, - Keywords, KeywordLabels, KeywordPerformanceReportDaily, KeywordPerformanceReportHourly, KeywordPerformanceReportMonthly, KeywordPerformanceReportWeekly, + Keywords, Labels, SearchQueryPerformanceReportDaily, SearchQueryPerformanceReportHourly, From b0175fac3d8a9df68517faa5e72feaff738583b6 Mon Sep 17 00:00:00 2001 From: Daryna Ishchenko Date: Wed, 1 Nov 2023 11:10:00 +0200 Subject: [PATCH 4/4] update streams number in unittests --- .../connectors/source-bing-ads/unit_tests/test_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ddcacdea9aced..1c0983b081395 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 @@ -32,7 +32,7 @@ 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) == 51 + assert len(streams) == 52 @patch.object(source_bing_ads.source, "Client")