Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmullapudi committed Sep 29, 2021
1 parent 8527a30 commit b0545e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@ def _make_authenticator(config: AmazonAdsConfig):

@staticmethod
def _choose_profiles(config: AmazonAdsConfig, profiles: List[Profile]):
print(config.profiles)
return filter(lambda profile: profile.profileId in config.profiles, profiles)
if not config.profiles:
return profiles
return filter(lambda profile: profile.profileId in config.profiles, profiles)
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Config:
region: AmazonAdsRegion = Field(
name="Region",
description="Region to pull data from",
default=AmazonAdsRegion.NA
)

profiles: List[int] = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def get_report_date_ranges(start_report_date: Optional[datetime]) -> Iterable[st
def stream_slices(
self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None
) -> Iterable[Optional[Mapping[str, Any]]]:
# Amazon ads updates the data for the next 3 days
LOOK_BACK_WINDOW = 3

if sync_mode == SyncMode.full_refresh:
# For full refresh stream use date from config start_date field.
start_date = self._start_date
Expand All @@ -266,8 +269,7 @@ def stream_slices(
start_date = stream_state.get(self.cursor_field)
if start_date:
start_date = pendulum.from_format(start_date, ReportStream.REPORT_DATE_FORMAT, tz="UTC")
# Amazon ads updates the data for the next 3 days
start_date += timedelta(days=-3)
start_date += timedelta(days=-LOOK_BACK_WINDOW)
else:
start_date = self._start_date

Expand Down

0 comments on commit b0545e5

Please sign in to comment.