Skip to content

Commit

Permalink
Fix source-google-ads on M1 Macs by pinning protobuf==3.14 (#13624)
Browse files Browse the repository at this point in the history
* Bump `source-google-ads` to build for both AMD and ARM

* pin protobuf==3.14

* update readme

* #263 oncall: bump google ads version 15.1.1, protobuf 3.20.0

* auto-bump connector version

Co-authored-by: Denys Davydov <davydov.den18@gmail.com>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 9, 2022
1 parent fca7f01 commit db67936
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
- name: Google Ads
sourceDefinitionId: 253487c0-2246-43ba-a21f-5116b20a2c50
dockerRepository: airbyte/source-google-ads
dockerImageTag: 0.1.41
dockerImageTag: 0.1.42
documentationUrl: https://docs.airbyte.io/integrations/sources/google-ads
icon: google-adwords.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-google-ads:0.1.41"
- dockerImage: "airbyte/source-google-ads:0.1.42"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/google-ads"
connectionSpecification:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ COPY main.py ./

ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.41
LABEL io.airbyte.version=0.1.42
LABEL io.airbyte.name=airbyte/source-google-ads
6 changes: 3 additions & 3 deletions airbyte-integrations/connectors/source-google-ads/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from setuptools import find_packages, setup

# grpcio-status is required by google ads but is not listed in its dependencies.
# this package must be of the same version range that grpcio is.
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "google-ads==14.1.0", "grpcio-status >= 1.38.1, < 2.0.0", "pendulum"]
# 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.1", "google-ads==15.1.1", "protobuf==3.20.0", "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 @@ -30,6 +30,7 @@
"geographic_report": "geographic_view",
"keyword_report": "keyword_view",
}
API_VERSION = "v9"


class GoogleAds:
Expand All @@ -39,7 +40,7 @@ def __init__(self, credentials: MutableMapping[str, Any]):
# `google-ads` library version `14.0.0` and higher requires an additional required parameter `use_proto_plus`.
# More details can be found here: https://developers.google.com/google-ads/api/docs/client-libs/python/protobuf-messages
credentials["use_proto_plus"] = True
self.client = GoogleAdsClient.load_from_dict(credentials)
self.client = GoogleAdsClient.load_from_dict(credentials, version=API_VERSION)
self.ga_service = self.client.get_service("GoogleAdsService")

def send_request(self, query: str, customer_id: str) -> Iterator[SearchGoogleAdsResponse]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json

from google.ads.googleads.errors import GoogleAdsException
from google.ads.googleads.v8 import GoogleAdsFailure
from google.ads.googleads.v9 import GoogleAdsFailure


class MockSearchRequest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import pytest
from airbyte_cdk.models import SyncMode
from google.ads.googleads.errors import GoogleAdsException
from google.ads.googleads.v8.errors.types.errors import ErrorCode, GoogleAdsError, GoogleAdsFailure
from google.ads.googleads.v8.errors.types.request_error import RequestErrorEnum
from google.ads.googleads.v9.errors.types.errors import ErrorCode, GoogleAdsError, GoogleAdsFailure
from google.ads.googleads.v9.errors.types.request_error import RequestErrorEnum
from grpc import RpcError
from source_google_ads.google_ads import GoogleAds
from source_google_ads.streams import ClickView
Expand Down
54 changes: 31 additions & 23 deletions docs/integrations/sources/google-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ This page contains the setup guide and reference information for the Google Ads
## Prerequisites

Google Ads registered account with
* Customer ID
* Login Customer ID (you can find more information about this field in [Google Ads docs](https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid))
* Custom GAQL Queries (if needed)

- Customer ID
- Login Customer ID (you can find more information about this field in [Google Ads docs](https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid))
- Custom GAQL Queries (if needed)

Also:
* Start Date
* End Date
* Conversion Window

- Start Date
- End Date
- Conversion Window

For Airbyte OSS:
Google Ads Account with an approved Developer Token. (note: In order to get API access to Google Ads, you must have a "manager" account; standard accounts cannot generate a Developer Token. This manager account must be created separately from your standard account. You can find more information about this distinction in the [Google Ads docs](https://support.google.com/google-ads/answer/6139186).)
You'll also need to find these values. See the [setup guide](#setup-guide) for instructions.

* Client ID
* Client Secret
* Refresh Token
- Client ID
- Client Secret
- Refresh Token

## Setup guide

### Step 1: Set up Google Ads

This guide will provide information as if starting from scratch. Please skip over any steps you have already completed.
Expand All @@ -32,18 +35,20 @@ This guide will provide information as if starting from scratch. Please skip ove
3. You should now have two Google Ads accounts: a normal account and a manager account. Link the Manager account to the normal account following [Google's documentation](https://support.google.com/google-ads/answer/7459601).
4. Select your `customer_id`. The `customer_id` refers to the id of each of your Google Ads accounts. This is the 10 digit number in the top corner of the page when you are in Google Ads UI. The source will only pull data from the accounts for which you provide an id. If you are having trouble finding it, check out [Google's instructions](https://support.google.com/google-ads/answer/1704344).

### Airbyte Open Source additional setup steps
1. Apply for a developer token (**make sure you follow our** [**instructions**](google-ads.md#how-to-apply-for-the-developer-token) on your Manager account. This token allows you to access your data from the Google Ads API. Here are [Google's instructions](https://developers.google.com/google-ads/api/docs/first-call/dev-token). The docs are a little unclear on this point, but you will _not_ be able to access your data via the Google Ads API until this token is approved. You cannot use a test developer token, it has to be at least a basic developer token. It usually takes Google 24 hours to respond to these applications. This developer token is the value you will use in the `developer_token` field.
2. Fetch your `client_id`, `client_secret`, and `refresh_token`. Google provides [instructions](https://developers.google.com/google-ads/api/docs/first-call/overview) on how to do this.
### Airbyte Open Source additional setup steps

1. Apply for a developer token (**make sure you follow our** [**instructions**](google-ads.md#how-to-apply-for-the-developer-token) on your Manager account. This token allows you to access your data from the Google Ads API. Here are [Google's instructions](https://developers.google.com/google-ads/api/docs/first-call/dev-token). The docs are a little unclear on this point, but you will _not_ be able to access your data via the Google Ads API until this token is approved. You cannot use a test developer token, it has to be at least a basic developer token. It usually takes Google 24 hours to respond to these applications. This developer token is the value you will use in the `developer_token` field.
2. Fetch your `client_id`, `client_secret`, and `refresh_token`. Google provides [instructions](https://developers.google.com/google-ads/api/docs/first-call/overview) on how to do this.

### How to apply for the developer token
Google is very picky about which software and which use case can get access to a developer token. The Airbyte team has worked with the Google Ads team to whitelist Airbyte and make sure you can get one (see [issue 1981](https://github.com/airbytehq/airbyte/issues/1981) for more information).
When you apply for a token, you need to mention:
### How to apply for the developer token

- Why you need the token (eg: want to run some internal analytics...)
- That you will be using the Airbyte Open Source project
- That you have full access to the code base (because we're open source)
- That you have full access to the server running the code (because you're self-hosting Airbyte)
Google is very picky about which software and which use case can get access to a developer token. The Airbyte team has worked with the Google Ads team to whitelist Airbyte and make sure you can get one (see [issue 1981](https://github.com/airbytehq/airbyte/issues/1981) for more information).
When you apply for a token, you need to mention:

- Why you need the token (eg: want to run some internal analytics...)
- That you will be using the Airbyte Open Source project
- That you have full access to the code base (because we're open source)
- That you have full access to the server running the code (because you're self-hosting Airbyte)

## Step 2: Set up the Google Ads connector in Airbyte

Expand All @@ -59,6 +64,7 @@ This guide will provide information as if starting from scratch. Please skip ove
8. You're done.

### For Airbyte OSS:

1. Create a new Google Ads source with a suitable name.
2. Get the customer ID for your account. Learn how to do that [here](https://support.google.com/google-ads/answer/1704344)
3. If your access to the account is through a manager account, get the customer ID of the manager account.
Expand All @@ -69,10 +75,11 @@ This guide will provide information as if starting from scratch. Please skip ove
## Supported sync modes

The Google Ads source connector supports the following[ sync modes](https://docs.airbyte.com/cloud/core-concepts#connection-sync-modes):
- Full Refresh | Overwrite
- Full Refresh | Append
- Incremental Sync | Append
- Incremental Sync | Deduped History

- Full Refresh | Overwrite
- Full Refresh | Append
- Incremental Sync | Append
- Incremental Sync | Deduped History

## Supported Streams

Expand Down Expand Up @@ -124,6 +131,7 @@ This source is constrained by whatever API limits are set for the Google Ads tha

| Version | Date | Pull Request | Subject |
|:---------|:-----------|:---------------------------------------------------------|:---------------------------------------------------------------------------------------------|
| `0.1.42` | 2022-06-08 | [13624](https://github.com/airbytehq/airbyte/pull/13624) | Update `google-ads` to 15.1.1, pin `protobuf==3.20.0` to work on MacOS M1 machines (AMD) |
| `0.1.41` | 2022-06-08 | [13618](https://github.com/airbytehq/airbyte/pull/13618) | Add missing dependency |
| `0.1.40` | 2022-06-02 | [13423](https://github.com/airbytehq/airbyte/pull/13423) | Fix the missing data [issue](https://github.com/airbytehq/airbyte/issues/12999) |
| `0.1.39` | 2022-05-18 | [12914](https://github.com/airbytehq/airbyte/pull/12914) | Fix GAQL query validation and log auth errors instead of failing the sync |
Expand Down

0 comments on commit db67936

Please sign in to comment.