Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Amazon Ads: fix fragile polling generator #8388 publish PR #9140

Merged
merged 4 commits into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- name: Amazon Ads
sourceDefinitionId: c6b0a29e-1da9-4512-9002-7bfd0cba2246
dockerRepository: airbyte/source-amazon-ads
dockerImageTag: 0.1.2
dockerImageTag: 0.1.3
documentationUrl: https://docs.airbyte.io/integrations/sources/amazon-ads
icon: amazonads.svg
sourceType: api
Expand Down
4 changes: 2 additions & 2 deletions airbyte-config/init/src/main/resources/seed/source_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-amazon-ads:0.1.2"
- dockerImage: "airbyte/source-amazon-ads:0.1.3"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/amazon-ads"
connectionSpecification:
Expand Down Expand Up @@ -133,7 +133,7 @@
- "2022-10-22"
type: "string"
region:
description: "Region to pull data from (EU/NA/FE/SANDBOX)"
description: "An enumeration."
default: "NA"
name: "Region"
title: "AmazonAdsRegion"
Expand Down
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=0.1.2
LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.name=airbyte/source-amazon-ads
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_targetings",
Expand Down Expand Up @@ -100,16 +90,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_product_targetings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_targetings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_targetings",
Expand Down Expand Up @@ -90,16 +80,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_product_targetings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_product_targetings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_product_ads",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite",
"source_defined_cursor": false
},
{
"stream": {
"name": "sponsored_display_targetings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"type": "string"
},
"region": {
"description": "Region to pull data from (EU/NA/FE/SANDBOX)",
"description": "An enumeration.",
"default": "NA",
"name": "Region",
"title": "AmazonAdsRegion",
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-amazon-ads/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from setuptools import find_packages, setup

MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1.12", "requests_oauthlib~=1.3.0", "pytz~=2021.1", "pendulum~=1.5.1"]
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1.46", "requests_oauthlib~=1.3.0", "pytz~=2021.1", "pendulum~=1.5.1"]

TEST_REQUIREMENTS = [
"pytest~=6.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ class Config:

client_id: str = Field(
name="Client ID",
description='Oauth client id <a href="https://advertising.amazon.com/API/docs/en-us/setting-up/step-1-create-lwa-app">How to create your Login with Amazon</a>',
description=(
'Oauth client id <a href="https://advertising.amazon.com/API/docs/en-us/setting-up/step-1-create-lwa-app">'
"How to create your Login with Amazon</a>"
),
)
client_secret: str = Field(
name="Client secret",
description='Oauth client secret <a href="https://advertising.amazon.com/API/docs/en-us/setting-up/step-1-create-lwa-app">How to create your Login with Amazon</a>',
description=(
'Oauth client secret <a href="https://advertising.amazon.com/API/docs/en-us/setting-up/step-1-create-lwa-app">'
"How to create your Login with Amazon</a>"
),
airbyte_secret=True,
)

Expand All @@ -30,11 +36,17 @@ class Config:
examples=[
"cpc_advertising:campaign_management",
],
description="By default its advertising::campaign_management, but customers may need to set scope to cpc_advertising:campaign_management.",
description=(
"By default its advertising::campaign_management,"
" but customers may need to set scope to cpc_advertising:campaign_management."
),
)
refresh_token: str = Field(
name="Oauth refresh token",
description='Oauth 2.0 refresh_token, <a href="https://developer.amazon.com/docs/login-with-amazon/conceptual-overview.html">read details here</a>',
description=(
'Oauth 2.0 refresh_token, <a href="https://developer.amazon.com/docs/login-with-amazon/conceptual-overview.html">'
"read details here</a>"
),
airbyte_secret=True,
)

Expand All @@ -61,9 +73,9 @@ def schema(cls, **kvargs):
# filter out it from the jsonschema output
schema["properties"] = {name: desc for name, desc in schema["properties"].items() if not name.startswith("_")}
# Transform pydantic generated enum for region
schema["definitions"]["AmazonAdsRegion"].pop("description")
schema["properties"]["region"].update(schema["definitions"]["AmazonAdsRegion"])
schema["properties"]["region"].pop("allOf", None)
schema["properties"]["region"].pop("$ref", None)
del schema["definitions"]
definitions = schema.pop("definitions", None)
if definitions:
schema["properties"]["region"].update(definitions["AmazonAdsRegion"])
schema["properties"]["region"].pop("allOf", None)
schema["properties"]["region"].pop("$ref", None)
return schema
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import requests
from airbyte_cdk.sources.streams.core import Stream
from airbyte_cdk.sources.streams.http import HttpStream
from airbyte_cdk.sources.utils.schema_helpers import expand_refs
from pydantic import BaseModel, ValidationError
from source_amazon_ads.constants import URL_MAPPING
from source_amazon_ads.schemas import CatalogModel
Expand Down Expand Up @@ -86,7 +87,9 @@ def model(self) -> CatalogModel:
"""

def get_json_schema(self):
return self.model.schema()
schema = self.model.schema()
expand_refs(schema)
return schema


# Basic full refresh stream
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/amazon-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Start date used for generating reports starting from the specified start date. S

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| `0.1.3` | 2021-12-28 | [\#8388](https://github.com/airbytehq/airbyte/pull/8388) | `Add retry if recoverable error occured for reporting stream processing` |
| `0.1.2` | 2021-10-01 | [\#6367](https://github.com/airbytehq/airbyte/pull/6461) | `Add option to pull data for different regions. Add option to choose profiles we want to pull data. Add lookback` |
| `0.1.1` | 2021-09-22 | [\#6367](https://github.com/airbytehq/airbyte/pull/6367) | `Add seller and vendor filters to profiles stream` |
| `0.1.0` | 2021-08-13 | [\#5023](https://github.com/airbytehq/airbyte/pull/5023) | `Initial version` |
Expand Down