infused-kim commented on issue #17111:
URL: https://github.com/apache/airflow/issues/17111#issuecomment-884689337
Today the Google v5 API stopped working. As a workaround until we get full
compatibility with the latest google ads version, you can update the google-ads
package to v8.0.0, which supports the v6 API that is still working.
Unfortunately even though the hook is supposed to be compatible with
google-ads up to v8.0.0, there is an import error:
```
af_webserver | File
"/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/google/ads/hooks/ads.py",
line 28, in <module>
af_webserver | from google.ads.google_ads.v2.types import GoogleAdsRow
af_webserver | ModuleNotFoundError: No module named
'google.ads.google_ads.v2'
```
This is due to the hook using a hardcoded v2 import. Changing it to v6 fixed
the import error.
You can do it using this patch file:
```patch
---
/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/google/ads/hooks/ads.py
2021-07-14 14:56:57.000000000 +0000
+++
/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/google/ads/hooks/ads_fixed.py
2021-07-22 06:21:47.989828054 +0000
@@ -25,7 +25,7 @@
from cached_property import cached_property
from google.ads.google_ads.client import GoogleAdsClient
from google.ads.google_ads.errors import GoogleAdsException
-from google.ads.google_ads.v2.types import GoogleAdsRow
+from google.ads.google_ads.v6.types import GoogleAdsRow
from google.api_core.page_iterator import GRPCIterator
from google.auth.exceptions import GoogleAuthError
from googleapiclient.discovery import Resource
@@ -76,7 +76,7 @@
:rtype: list[GoogleAdsRow]
"""
- default_api_version = "v5"
+ default_api_version = "v6"
def __init__(
self,
```
As I am using docker, adding this to my Dockerfile resolved the issue for me:
```Dockerfile
# Update google ads library to support non-deprecated API versions
RUN pip install google-ads==8.0.0
# Patch import errors in provider
COPY patches/2021_07_af_google_ads_v6_fix.patch .
RUN patch -d / -p0 < 2021_07_af_google_ads_v6_fix.patch
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]