Skip to content

Commit

Permalink
update ga api version to v15
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhilashkari17 committed Feb 2, 2024
1 parent b094d6d commit 066983e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-google-ads/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.2", "google-ads==20.0.0", "protobuf", "pendulum"]
MAIN_REQUIREMENTS = ["airbyte-cdk>=0.2.2", "google-ads==22.1.0", "protobuf", "pendulum"]

TEST_REQUIREMENTS = ["pytest~=6.1", "pytest-mock", "freezegun", "requests-mock"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_json_schema(self) -> Dict[str, Any]:
# Represents protobuf message and could be anything, set custom
# attribute "protobuf_message" to convert it to a string (or
# array of strings) later.
# https://developers.google.com/google-ads/api/reference/rpc/v11/GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType?hl=en#message
# https://developers.google.com/google-ads/api/reference/rpc/v15/GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType?hl=en#message
if node.is_repeated:
output_type = ["array", "null"]
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.v13.errors.types.authorization_error import AuthorizationErrorEnum
from google.ads.googleads.v15.errors.types.authorization_error import AuthorizationErrorEnum
from pendulum import parse, today

from .custom_query_stream import CustomQuery, IncrementalCustomQuery
Expand Down Expand Up @@ -51,7 +51,7 @@ def _validate_and_transform(config: Mapping[str, Any]):
try:
query["query"] = GAQL.parse(query["query"])
except ValueError:
message = f"The custom GAQL query {query['table_name']} failed. Validate your GAQL query with the Google Ads query validator. https://developers.google.com/google-ads/api/fields/v13/query_validator"
message = f"The custom GAQL query {query['table_name']} failed. Validate your GAQL query with the Google Ads query validator. https://developers.google.com/google-ads/api/fields/v15/query_validator"
raise AirbyteTracedException(message=message, failure_type=FailureType.config_error)
return config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.v11.errors.types.authorization_error import AuthorizationErrorEnum
from google.ads.googleads.v11.errors.types.request_error import RequestErrorEnum
from google.ads.googleads.v11.services.services.google_ads_service.pagers import SearchPager
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 import GoogleAds
from .models import Customer
Expand Down Expand Up @@ -275,7 +275,7 @@ def get_query(self, stream_slice: Mapping[str, Any] = None) -> str:

class Accounts(IncrementalGoogleAdsStream):
"""
Accounts stream: https://developers.google.com/google-ads/api/fields/v11/customer
Accounts stream: https://developers.google.com/google-ads/api/fields/v15/customer
"""

primary_key = ["customer.id", "segments.date"]
Expand All @@ -292,7 +292,7 @@ class ServiceAccounts(GoogleAdsStream):

class Campaigns(IncrementalGoogleAdsStream):
"""
Campaigns stream: https://developers.google.com/google-ads/api/fields/v11/campaign
Campaigns stream: https://developers.google.com/google-ads/api/fields/v15/campaign
"""

transformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization)
Expand All @@ -301,7 +301,7 @@ class Campaigns(IncrementalGoogleAdsStream):

class CampaignLabels(GoogleAdsStream):
"""
Campaign labels stream: https://developers.google.com/google-ads/api/fields/v11/campaign_label
Campaign labels stream: https://developers.google.com/google-ads/api/fields/v15/campaign_label
"""

# Note that this is a string type. Google doesn't return a more convenient identifier.
Expand All @@ -310,15 +310,15 @@ class CampaignLabels(GoogleAdsStream):

class AdGroups(IncrementalGoogleAdsStream):
"""
AdGroups stream: https://developers.google.com/google-ads/api/fields/v11/ad_group
AdGroups stream: https://developers.google.com/google-ads/api/fields/v15/ad_group
"""

primary_key = ["ad_group.id", "segments.date"]


class AdGroupLabels(GoogleAdsStream):
"""
Ad Group Labels stream: https://developers.google.com/google-ads/api/fields/v11/ad_group_label
Ad Group Labels stream: https://developers.google.com/google-ads/api/fields/v15/ad_group_label
"""

# Note that this is a string type. Google doesn't return a more convenient identifier.
Expand All @@ -327,15 +327,15 @@ class AdGroupLabels(GoogleAdsStream):

class AdGroupAds(IncrementalGoogleAdsStream):
"""
AdGroups stream: https://developers.google.com/google-ads/api/fields/v11/ad_group_ad
AdGroups stream: https://developers.google.com/google-ads/api/fields/v15/ad_group_ad
"""

primary_key = ["ad_group_ad.ad.id", "segments.date"]


class AdGroupAdLabels(GoogleAdsStream):
"""
Ad Group Ad Labels stream: https://developers.google.com/google-ads/api/fields/v11/ad_group_ad_label
Ad Group Ad Labels stream: https://developers.google.com/google-ads/api/fields/v15/ad_group_ad_label
"""

# Note that this is a string type. Google doesn't return a more convenient identifier.
Expand All @@ -345,61 +345,61 @@ class AdGroupAdLabels(GoogleAdsStream):
class AccountPerformanceReport(IncrementalGoogleAdsStream):
primary_key = ["customer.id", "segments.ad_network_type", "segments.date", "segments.device"]
"""
AccountPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v11/customer
AccountPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v15/customer
Google Ads API field mapping: https://developers.google.com/google-ads/api/docs/migration/mapping#account_performance
"""


class AdGroupAdReport(IncrementalGoogleAdsStream):
"""
AdGroupAdReport stream: https://developers.google.com/google-ads/api/fields/v11/ad_group_ad
AdGroupAdReport stream: https://developers.google.com/google-ads/api/fields/v15/ad_group_ad
Google Ads API field mapping: https://developers.google.com/google-ads/api/docs/migration/mapping#ad_performance
"""


class DisplayKeywordPerformanceReport(IncrementalGoogleAdsStream):
"""
DisplayKeywordPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v11/display_keyword_view
DisplayKeywordPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v15/display_keyword_view
Google Ads API field mapping: https://developers.google.com/google-ads/api/docs/migration/mapping#display_keyword_performance
"""


class DisplayTopicsPerformanceReport(IncrementalGoogleAdsStream):
"""
DisplayTopicsPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v11/topic_view
DisplayTopicsPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v15/topic_view
Google Ads API field mapping: https://developers.google.com/google-ads/api/docs/migration/mapping#display_topics_performance
"""


class ShoppingPerformanceReport(IncrementalGoogleAdsStream):
"""
ShoppingPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v11/shopping_performance_view
ShoppingPerformanceReport stream: https://developers.google.com/google-ads/api/fields/v15/shopping_performance_view
Google Ads API field mapping: https://developers.google.com/google-ads/api/docs/migration/mapping#shopping_performance
"""


class UserLocationReport(IncrementalGoogleAdsStream):
"""
UserLocationReport stream: https://developers.google.com/google-ads/api/fields/v11/user_location_view
UserLocationReport stream: https://developers.google.com/google-ads/api/fields/v15/user_location_view
Google Ads API field mapping: https://developers.google.com/google-ads/api/docs/migration/mapping#geo_performance
"""


class GeographicReport(IncrementalGoogleAdsStream):
"""
UserLocationReport stream: https://developers.google.com/google-ads/api/fields/v11/geographic_view
UserLocationReport stream: https://developers.google.com/google-ads/api/fields/v15/geographic_view
"""


class KeywordReport(IncrementalGoogleAdsStream):
"""
UserLocationReport stream: https://developers.google.com/google-ads/api/fields/v11/keyword_view
UserLocationReport stream: https://developers.google.com/google-ads/api/fields/v15/keyword_view
"""


class ClickView(IncrementalGoogleAdsStream):
"""
ClickView stream: https://developers.google.com/google-ads/api/reference/rpc/v11/ClickView
ClickView stream: https://developers.google.com/google-ads/api/reference/rpc/v15/ClickView
"""

primary_key = ["click_view.gclid", "segments.date", "segments.ad_network_type"]
Expand Down

0 comments on commit 066983e

Please sign in to comment.