From c80afb3f98bbc39df209f3b5167f4ae437d13e0b Mon Sep 17 00:00:00 2001 From: Martin Loetzsch Date: Tue, 27 Mar 2018 15:35:22 +0200 Subject: [PATCH] Improve ordering of output columns (was quite random before) --- CHANGELOG.md | 13 ++++++++- bingads_downloader/config.py | 2 +- bingads_downloader/downloader.py | 48 +++++++++++++++++++------------- setup.py | 2 +- 4 files changed, 43 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46fb500..7484934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,18 @@ # Changelog -## 2.0 +## 2.1.0 +2018-03-27 + +- Improve ordering of output columns (was quite random before) + +**required changes** + +- Adapt ETL to new column order + + +## 2.0.0 2018-03-14 + - Download both the keywords and the ad performance reports as two separate files (major version bump as the file name is different) ## 1.2.2 diff --git a/bingads_downloader/config.py b/bingads_downloader/config.py index aca5197..58cc4a5 100644 --- a/bingads_downloader/config.py +++ b/bingads_downloader/config.py @@ -55,4 +55,4 @@ def retry_timeout_interval() -> int: def output_file_version() -> str: """A suffix that is added to output files, denoting a version of the data format""" - return 'v2' + return 'v3' diff --git a/bingads_downloader/downloader.py b/bingads_downloader/downloader.py index 477a67d..2a12b64 100644 --- a/bingads_downloader/downloader.py +++ b/bingads_downloader/downloader.py @@ -143,18 +143,29 @@ def build_ad_performance_request_for_single_day(api_client: BingReportClient, report_columns = api_client.factory.create('ArrayOfAdPerformanceReportColumn') report_columns.AdPerformanceReportColumn.append([ + "TimePeriod", + "DeviceType", + + "AccountId", "AccountName", "AccountNumber", - "AccountId", - "TimePeriod", - "CampaignName", + "AccountStatus", + + "CampaignId", + "CampaignName", + "CampaignStatus", + + "AdGroupId", "AdGroupName", + "AdGroupStatus", + "AdId", - "AdGroupId", "AdTitle", "AdDescription", "AdType", + "AdLabels", + "Impressions", "Clicks", "Ctr", @@ -162,12 +173,7 @@ def build_ad_performance_request_for_single_day(api_client: BingReportClient, "AveragePosition", "Conversions", "ConversionRate", - "CostPerConversion", - "DeviceType", - "AccountStatus", - "CampaignStatus", - "AdGroupStatus", - "AdLabels" + "CostPerConversion" ]) report_request.Columns = report_columns @@ -207,6 +213,10 @@ def build_keyword_performance_request_for_single_day(api_client: BingReportClien report_columns = api_client.factory.create('ArrayOfKeywordPerformanceReportColumn') report_columns.KeywordPerformanceReportColumn.append([ "TimePeriod", + "Network", + "DeviceType", + "BidMatchType", + "AccountId", "AccountName", "CampaignId", @@ -214,10 +224,9 @@ def build_keyword_performance_request_for_single_day(api_client: BingReportClien "AdGroupId", "AdGroupName", "AdId", - "Keyword", "KeywordId", - "DeviceType", - "BidMatchType", + "Keyword", + "Clicks", "Impressions", "Ctr", @@ -226,7 +235,6 @@ def build_keyword_performance_request_for_single_day(api_client: BingReportClien "QualityScore", "Conversions", "Revenue", - "Network" ]) report_request.Columns = report_columns @@ -270,13 +278,15 @@ def build_campaign_performance_request_for_single_day(api_client: BingReportClie report_columns = api_client.factory.create('ArrayOfCampaignPerformanceReportColumn') report_columns.CampaignPerformanceReportColumn.append([ - "AccountName", - "AccountId", "TimePeriod", - "CampaignName", + + "AccountId", + "AccountName", "CampaignId", - "Spend", - "CampaignLabels" + "CampaignName", + "CampaignLabels", + + "Spend" ]) report_request.Columns = report_columns return report_request diff --git a/setup.py b/setup.py index 461e2af..520a162 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='bingads-performance-downloader', - version='2.0.0', + version='2.1.0', description="Downloads data from the BingAds Api to local files for usage in a data warehouse",