Skip to content

Commit a02e386

Browse files
authored
fix(source-amazon-ads): set is_resumable only for Fullrefresh streams (#48343)
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
1 parent dd537ab commit a02e386

File tree

9 files changed

+9
-7
lines changed

9 files changed

+9
-7
lines changed

airbyte-integrations/connectors/source-amazon-ads/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ data:
1313
connectorSubtype: api
1414
connectorType: source
1515
definitionId: c6b0a29e-1da9-4512-9002-7bfd0cba2246
16-
dockerImageTag: 6.1.2
16+
dockerImageTag: 6.1.3
1717
dockerRepository: airbyte/source-amazon-ads
1818
documentationUrl: https://docs.airbyte.com/integrations/sources/amazon-ads
1919
githubIssueLabel: source-amazon-ads

airbyte-integrations/connectors/source-amazon-ads/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "6.1.2"
6+
version = "6.1.3"
77
name = "source-amazon-ads"
88
description = "Source implementation for Amazon Ads."
99
authors = [ "Airbyte <contact@airbyte.io>",]

airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/attribution_report.py

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class AttributionReport(AmazonAdsStream):
5353
https://advertising.amazon.com/API/docs/en-us/amazon-attribution-prod-3p/#/
5454
"""
5555

56+
is_resumable = False
5657
primary_key = None
5758
data_field = "reports"
5859
page_size = 300

airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ class BasicAmazonAdsStream(Stream, ABC):
100100
Base class for all Amazon Ads streams.
101101
"""
102102

103-
is_resumable = False
104-
105103
def __init__(self, config: Mapping[str, Any], profiles: List[dict[str, Any]] = None):
106104
self._profiles = profiles or []
107105
self._client_id = config["client_id"]
@@ -183,6 +181,7 @@ class SubProfilesStream(AmazonAdsStream):
183181
Stream for getting resources with pagination support and getting resources based on list of profiles set by source.
184182
"""
185183

184+
is_resumable = False
186185
page_size = 100
187186

188187
def __init__(self, *args, **kwargs):

airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/portfolios.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Portfolios(AmazonAdsStream):
1313
https://advertising.amazon.com/API/docs/en-us/reference/2/portfolios
1414
"""
1515

16+
is_resumable = False
1617
primary_key = "portfolioId"
1718

1819
def path(self, **kwargs) -> str:

airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/profiles.py

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Profiles(AmazonAdsStream):
1515
https://advertising.amazon.com/API/docs/en-us/reference/2/profiles#/Profiles
1616
"""
1717

18+
is_resumable = False
1819
primary_key = "profileId"
1920

2021
def path(self, **kwargs) -> str:

airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/report_streams/report_streams.py

-3
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,6 @@ def state(self):
307307
def state(self, value):
308308
self._state = deepcopy(value)
309309

310-
def get_updated_state(self, current_stream_state: Dict[str, Any], latest_data: Mapping[str, Any]) -> Mapping[str, Any]:
311-
return self._state
312-
313310
def _update_state(self, profile: dict[str, Any], report_date: str):
314311
report_date = pendulum.from_format(report_date, self.REPORT_DATE_FORMAT).date()
315312
look_back_date = pendulum.today(tz=profile["timezone"]).date().subtract(days=self._look_back_window - 1)

airbyte-integrations/connectors/source-amazon-ads/unit_tests/integrations/test_report_streams.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import pendulum
88
import requests_mock
9+
from airbyte_cdk.models import AirbyteStateBlob
910
from airbyte_cdk.models import Level as LogLevel
1011
from airbyte_cdk.models import SyncMode
1112
from airbyte_cdk.test.mock_http import HttpMocker, HttpRequestMatcher
@@ -211,6 +212,7 @@ def test_given_file_when_read_brands_v3_report_then_return_records(self, http_mo
211212
)
212213

213214
output = read_stream("sponsored_brands_v3_report_stream", SyncMode.full_refresh, self._config)
215+
assert output.most_recent_state.stream_state == AirbyteStateBlob({"1":{'reportDate': '2024-11-06'}})
214216
assert len(output.records) == 1
215217

216218
@HttpMocker()

docs/integrations/sources/amazon-ads.md

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Information about expected report generation waiting time can be found [here](ht
153153

154154
| Version | Date | Pull Request | Subject |
155155
|:--------|:-----------|:---------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|
156+
| 6.1.3 | 2024-11-05 | [48343](https://github.com/airbytehq/airbyte/pull/48343) | Set is_resumable only for FullRefresh streams |
156157
| 6.1.2 | 2024-11-04 | [48138](https://github.com/airbytehq/airbyte/pull/48138) | Add error message for TooManyRequests exception |
157158
| 6.1.1 | 2024-11-04 | [48128](https://github.com/airbytehq/airbyte/pull/48128) | Fix date parse in report streams |
158159
| 6.1.0 | 2024-11-01 | [47940](https://github.com/airbytehq/airbyte/pull/47940) | Bump CDK to ^5 |

0 commit comments

Comments
 (0)