From b0d3245cd0e07767f8c8c0d0dc2542c00e4a60c3 Mon Sep 17 00:00:00 2001 From: Alexandros Milaios Date: Wed, 25 Sep 2024 09:05:26 +0300 Subject: [PATCH] chore: update google ads to use version v17 --- airbyte-integrations/connectors/source-google-ads/setup.py | 2 +- .../source-google-ads/source_google_ads/google_ads.py | 6 ++---- .../source-google-ads/source_google_ads/source.py | 2 +- .../source-google-ads/source_google_ads/streams.py | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/airbyte-integrations/connectors/source-google-ads/setup.py b/airbyte-integrations/connectors/source-google-ads/setup.py index 677fbed1a88c..3f584e9f7192 100644 --- a/airbyte-integrations/connectors/source-google-ads/setup.py +++ b/airbyte-integrations/connectors/source-google-ads/setup.py @@ -7,7 +7,7 @@ # pin protobuf==3.20.0 as other versions may cause problems on different architectures # (see https://github.com/airbytehq/airbyte/issues/13580) -MAIN_REQUIREMENTS = ["airbyte-cdk==0.67", "google-ads==22.1.0", "protobuf", "pendulum"] +MAIN_REQUIREMENTS = ["airbyte-cdk==0.67", "google-ads==25.0.0", "protobuf", "pendulum"] TEST_REQUIREMENTS = ["pytest~=6.1", "pytest-mock", "freezegun", "requests-mock"] diff --git a/airbyte-integrations/connectors/source-google-ads/source_google_ads/google_ads.py b/airbyte-integrations/connectors/source-google-ads/source_google_ads/google_ads.py index 712fcbcbba4b..618299ca004c 100644 --- a/airbyte-integrations/connectors/source-google-ads/source_google_ads/google_ads.py +++ b/airbyte-integrations/connectors/source-google-ads/source_google_ads/google_ads.py @@ -12,7 +12,7 @@ from airbyte_cdk.models import FailureType from airbyte_cdk.utils import AirbyteTracedException from google.ads.googleads.client import GoogleAdsClient -from google.ads.googleads.v15.services.types.google_ads_service import GoogleAdsRow, SearchGoogleAdsResponse +from google.ads.googleads.v17.services.types.google_ads_service import GoogleAdsRow, SearchGoogleAdsResponse from google.api_core.exceptions import ServerError, TooManyRequests from google.auth import exceptions from proto.marshal.collections import Repeated, RepeatedComposite @@ -36,12 +36,11 @@ "geographic_report": "geographic_view", "keyword_report": "keyword_view", } -API_VERSION = "v15" +API_VERSION = "v17" logger = logging.getLogger("airbyte") class GoogleAds: - DEFAULT_PAGE_SIZE = 1000 def __init__(self, credentials: MutableMapping[str, Any]): # `google-ads` library version `14.0.0` and higher requires an additional required parameter `use_proto_plus`. @@ -70,7 +69,6 @@ def send_request(self, query: str, customer_id: str) -> Iterator[SearchGoogleAds client = self.client search_request = client.get_type("SearchGoogleAdsRequest") search_request.query = query - search_request.page_size = self.DEFAULT_PAGE_SIZE search_request.customer_id = customer_id return [self.ga_service.search(search_request)] diff --git a/airbyte-integrations/connectors/source-google-ads/source_google_ads/source.py b/airbyte-integrations/connectors/source-google-ads/source_google_ads/source.py index 4867df2acfd7..7f9df8dfd712 100644 --- a/airbyte-integrations/connectors/source-google-ads/source_google_ads/source.py +++ b/airbyte-integrations/connectors/source-google-ads/source_google_ads/source.py @@ -12,7 +12,7 @@ from airbyte_cdk.sources.streams import Stream from airbyte_cdk.utils import AirbyteTracedException from google.ads.googleads.errors import GoogleAdsException -from google.ads.googleads.v15.errors.types.authorization_error import AuthorizationErrorEnum +from google.ads.googleads.v17.errors.types.authorization_error import AuthorizationErrorEnum from pendulum import parse, today from .custom_query_stream import CustomQuery, IncrementalCustomQuery diff --git a/airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py b/airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py index 1f7a880c7942..d92f6af4c49d 100644 --- a/airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py +++ b/airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py @@ -11,9 +11,9 @@ from airbyte_cdk.sources.streams import IncrementalMixin, Stream from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer from google.ads.googleads.errors import GoogleAdsException -from google.ads.googleads.v15.errors.types.authorization_error import AuthorizationErrorEnum -from google.ads.googleads.v15.errors.types.request_error import RequestErrorEnum -from google.ads.googleads.v15.services.services.google_ads_service.pagers import SearchPager +from google.ads.googleads.v17.errors.types.authorization_error import AuthorizationErrorEnum +from google.ads.googleads.v17.errors.types.request_error import RequestErrorEnum +from google.ads.googleads.v17.services.services.google_ads_service.pagers import SearchPager from .google_ads import GoogleAds from .models import Customer