Skip to content

Commit

Permalink
🐛 Source Bing Ads: remove primary key for the geographic performance …
Browse files Browse the repository at this point in the history
…reports (airbytehq#31432)

Co-authored-by: davydov-d <davydov-d@users.noreply.github.com>
  • Loading branch information
2 people authored and ariesgun committed Oct 20, 2023
1 parent 4cb9d11 commit 1e0e710
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
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=1.0.0
LABEL io.airbyte.version=1.0.1
LABEL io.airbyte.name=airbyte/source-bing-ads
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 47f25999-dd5e-4636-8c39-e7cea2453331
dockerImageTag: 1.0.0
dockerImageTag: 1.0.1
dockerRepository: airbyte/source-bing-ads
githubIssueLabel: source-bing-ads
icon: bingads.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ class GeographicPerformanceReport(PerformanceReportsMixin, BingAdsStream):
cursor_field = "TimePeriod"
report_schema_name = "geographic_performance_report"

# Need to override the primary key here because the one inherited from the PerformanceReportsMixin
# is incorrect for the geographic performance reports
primary_key = None

report_columns = [
"AccountId",
"CampaignId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
#

import copy
from unittest.mock import Mock

import pendulum
import pytest
from bingads.v13.internal.reporting.row_report_iterator import _RowReportRecord, _RowValues
from source_bing_ads.reports import PerformanceReportsMixin, ReportsMixin
from source_bing_ads.source import SourceBingAds
from source_bing_ads.source import (
GeographicPerformanceReportDaily,
GeographicPerformanceReportHourly,
GeographicPerformanceReportMonthly,
GeographicPerformanceReportWeekly,
SourceBingAds,
)


class TestClient:
Expand Down Expand Up @@ -137,3 +145,23 @@ def test_report_get_start_date_performance_report_wo_stream_state():
stream_state = {}
account_id = "123"
assert reports_start_date.subtract(days=days_to_subtract) == test_report.get_start_date(stream_state, account_id)


@pytest.mark.parametrize(
"performance_report_cls",
(
GeographicPerformanceReportDaily,
GeographicPerformanceReportHourly,
GeographicPerformanceReportMonthly,
GeographicPerformanceReportWeekly,
),
)
def test_geographic_performance_report_pk(performance_report_cls):
config = {
"developer_token": "developer_token",
"client_id": "client_id",
"refresh_token": "refresh_token",
"reports_start_date": "2020-01-01T00:00:00Z",
}
stream = performance_report_cls(client=Mock(), config=config)
assert stream.primary_key is None
1 change: 1 addition & 0 deletions docs/integrations/sources/bing-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ The Bing Ads API limits the number of requests for all Microsoft Advertising cli

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------|
| 1.0.1 | 2023-10-16 | [31432](https://github.com/airbytehq/airbyte/pull/31432) | Remove primary keys from the geographic performance reports - complete what was missed in version 1.0.0 |
| 1.0.0 | 2023-10-11 | [31277](https://github.com/airbytehq/airbyte/pull/31277) | Remove primary keys from the geographic performance reports. |
| 0.2.3 | 2023-09-28 | [30834](https://github.com/airbytehq/airbyte/pull/30834) | Wrap auth error with the config error. |
| 0.2.2 | 2023-09-27 | [30791](https://github.com/airbytehq/airbyte/pull/30791) | Fix missing fields for geographic performance reports. |
Expand Down

0 comments on commit 1e0e710

Please sign in to comment.