You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/02 15:12:36 UTC

[GitHub] [airflow] yossarian-p22 opened a new issue, #26136: GoogleAdsToGcsOperator not handling properly `attributes` parameter with string "type"

yossarian-p22 opened a new issue, #26136:
URL: https://github.com/apache/airflow/issues/26136

   ### Apache Airflow Provider(s)
   
   google
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-google==8.1.0
   
   ### Apache Airflow version
   
   2.2.5
   
   ### Operating System
   
   Debian GNU/Linux 10 (buster)
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   When running `GoogleAdsToGcsOperator` with parameter `attributes` containing string "type", an error occurs:
   ```
   [2022-09-02, 16:56:57 CEST] {ads.py:238} INFO - Fetched Google Ads Iterators
   [2022-09-02, 16:56:57 CEST] {ads.py:252} INFO - Extracting data from returned Google Ads Iterators
   [2022-09-02, 16:56:57 CEST] {ads_to_gcs.py:115} ERROR - An error occurred in converting the Google Ad Rows. 
    Error type
   [2022-09-02, 16:56:57 CEST] {taskinstance.py:1774} ERROR - Task failed with exception
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/google/ads/transfers/ads_to_gcs.py", line 113, in execute
       converted_rows = [getter(row) for row in rows]
     File "/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/google/ads/transfers/ads_to_gcs.py", line 113, in <listcomp>
       converted_rows = [getter(row) for row in rows]
   AttributeError: type
   ```
   String "type" (like ad_group_ad.ad.type) can be present in `query` parameter but causes error when present also in parameter `attributes`.
   
   ### What you think should happen instead
   
   Google Ads Rows should be converted the same way they are converted when string 'type' is not present in parameter `attributes`.
   
   ### How to reproduce
   
   Run `GoogleAdsToGcsOperator` with parameters:
   ```
   {
       "query": "SELECT ad_group_ad.ad.id, ad_group_ad.ad.name, ad_group_ad.ad.type, ad_group_ad.ad.url_custom_parameters, ad_group_ad.ad.image_ad.image_url, ad_group_ad.labels, ad_group_ad.ad.image_ad.name, ad_group_ad.ad.image_ad.preview_image_url, ad_group_ad.status, ad_group.id, campaign.id, customer.id FROM ad_group_ad WHERE segments.date DURING LAST_7_DAYS",
       "attributes": [
           "ad_group_ad.ad.id",
           "ad_group_ad.ad.name",
           "ad_group_ad.ad.type",
           "ad_group_ad.ad.url_custom_parameters",
           "ad_group_ad.ad.image_ad.image_url",
           "ad_group_ad.labels",
           "ad_group_ad.ad.image_ad.name",
           "ad_group_ad.ad.image_ad.preview_image_url",
           "ad_group_ad.status",
           "ad_group.id",
           "campaign.id",
           "customer.id"
       ]
   }
   ```
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] yossarian-p22 closed issue #26136: GoogleAdsToGcsOperator not handling properly `attributes` parameter with string "type"

Posted by GitBox <gi...@apache.org>.
yossarian-p22 closed issue #26136: GoogleAdsToGcsOperator not handling properly `attributes` parameter with string "type"
URL: https://github.com/apache/airflow/issues/26136


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] yossarian-p22 commented on issue #26136: GoogleAdsToGcsOperator not handling properly `attributes` parameter with string "type"

Posted by GitBox <gi...@apache.org>.
yossarian-p22 commented on issue #26136:
URL: https://github.com/apache/airflow/issues/26136#issuecomment-1236802122

   Using "*.type_" instead of "*.type" works for all 'type' fields. Thanks a lot!


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on issue #26136: GoogleAdsToGcsOperator not handling properly `attributes` parameter with string "type"

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #26136:
URL: https://github.com/apache/airflow/issues/26136#issuecomment-1235618614

   Thanks for opening your first issue here! Be sure to follow the issue template!
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] tirkarthi commented on issue #26136: GoogleAdsToGcsOperator not handling properly `attributes` parameter with string "type"

Posted by GitBox <gi...@apache.org>.
tirkarthi commented on issue #26136:
URL: https://github.com/apache/airflow/issues/26136#issuecomment-1236059389

   It seems there is some inconsistency or issue in the library. Can you try using "ad_group_ad.ad.type_" in attributes?
   
   https://github.com/googleads/google-ads-python/blob/6b908c0db0d54214ac589e28810a0e8917eacd55/google/ads/googleads/v10/resources/types/ad.py#L275
   
   ```python
   python
   Python 3.7.13 (default, Aug 23 2022, 10:09:20) 
   [GCC 10.2.1 20210110] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import operator
   >>> getter_type = operator.attrgetter("ad_group_ad.ad.type")
   >>> getter_type_ = operator.attrgetter("ad_group_ad.ad.type_")
   >>> from google.ads.googleads.v10.services.types.google_ads_service import GoogleAdsRow
   >>> getter_type(GoogleAdsRow())
   Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/proto/message.py", line 610, in __getattr__
       pb_type = self._meta.fields[key].pb_type
   KeyError: 'type'
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/local/lib/python3.7/site-packages/proto/message.py", line 615, in __getattr__
       raise AttributeError(str(ex))
   AttributeError: 'type'
   >>> getter_type_(GoogleAdsRow())
   <AdType.UNSPECIFIED: 0>
   ```
   
   But using latest package from github works fine with "type" https://github.com/googleads/google-ads-python
   
   ```python
   python                
   Python 3.10.6 (main, Aug  2 2022, 15:11:28) [GCC 9.4.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> from google.ads.googleads.v10.services.types.google_ads_service import GoogleAdsRow
   >>> import operator
   >>> from google.ads.googleads.v10.services.types.google_ads_service import GoogleAdsRow
   >>> getter_type = operator.attrgetter("ad_group_ad.ad.type")
   >>> getter_type(GoogleAdsRow())
   <AdType.UNSPECIFIED: 0>
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org