Skip to content

Commit

Permalink
Revert "region, report_wait_timeout, report_generation_max_retries is…
Browse files Browse the repository at this point in the history
… required"

This reverts commit de6dbab.
  • Loading branch information
grubberr committed Apr 28, 2022
1 parent 03b0cf1 commit d11fc25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#

from typing import Any, Dict, List, Type
from typing import List

from airbyte_cdk.models import AdvancedAuth, AuthFlowType, OAuthConfigSpecification
from airbyte_cdk.sources.utils.schema_helpers import expand_refs
Expand All @@ -16,20 +16,8 @@ class Config:
# ignore extra attributes during model initialization
# https://pydantic-docs.helpmanual.io/usage/model_config/
extra = Extra.ignore

@staticmethod
def schema_extra(schema: Dict[str, Any], model: Type["AmazonAdsConfig"]) -> None:
# it's default, but better to be more explicit
schema["additionalProperties"] = True

# force require "region" field
# pydantic don't require "region" because it has default value
if "region" not in schema["required"]:
schema["required"].append("region")
if "report_wait_timeout" not in schema["required"]:
schema["required"].append("report_wait_timeout")
if "report_generation_max_retries" not in schema["required"]:
schema["required"].append("report_generation_max_retries")
# it's default, but better to be more explicit
schema_extra = {"additionalProperties": True}

auth_type: str = Field(default="oauth2.0", const=True, order=0)

Expand All @@ -54,22 +42,22 @@ def schema_extra(schema: Dict[str, Any], model: Type["AmazonAdsConfig"]) -> None
)

region: AmazonAdsRegion = Field(
title="Region",
title="Region *",
description='Region to pull data from (EU/NA/FE/SANDBOX). See <a href="https://advertising.amazon.com/API/docs/en-us/info/api-overview#api-endpoints">docs</a> for more details.',
default=AmazonAdsRegion.NA,
order=4,
)

report_wait_timeout: int = Field(
title="Report Wait Timeout",
title="Report Wait Timeout *",
description="Timeout duration in minutes for Reports. Eg. 30",
default=30,
examples=[30, 120],
order=5,
)

report_generation_max_retries: int = Field(
title="Report Generation Maximum Retries",
title="Report Generation Maximum Retries *",
description="Maximum retries Airbyte will attempt for fetching Report Data. Eg. 5",
default=5,
examples=[5, 10, 15],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _get_init_report_body(self, report_date: str, record_type: str, profile):
metrics_list = copy(metrics_list)
metrics_list.remove("sku")

# adId is automatically added to the report by amazon and requesting adId causes an amazon error
# adId is automatically added to the report by amazon and requesting adId causes an amazon error
if "adId" in metrics_list:
metrics_list.remove("adId")

Expand Down

0 comments on commit d11fc25

Please sign in to comment.