Change Event Resource Type

221 views
Skip to first unread message

Scott Vaillancourt

unread,
Aug 30, 2021, 5:17:31 PM8/30/21
to AdWords API and Google Ads API Forum
I'm using Python to run a report in Google Ads that pulls change events for the past 28 days. The versions of software installed and the query are shown below:
  • google-ads:  13.0.0
  • google-api_core: 1.31.2
  • google-api-python-client: 2.18.0
query = '''
    SELECT
      change_event.change_date_time,
      change_event.change_resource_name,
      change_event.change_resource_type,
      change_event.resource_change_operation,
      change_event.user_email,
      change_event.changed_fields,
      campaign.name
    FROM change_event
    WHERE
      change_event.change_date_time BETWEEN "{:s}" AND "{:s}"
    LIMIT 1200'''.format(start, end)

resp = list(gas.search(customer_id=cid, query=query))

The reporting service is instantiated as follows: gas = client.get_service('GoogleAdsService', version='v8').

The issue I'm encountering is with the values returned for change_resource_type. Specifically, in most cases the data type of the value is "<enum 'ChangeEventResourceType'>". However, in some cases it's returning an "int". It appears that this is happening when the resource type is a value that was introduced in version 8. Here are two instances showing one enum and one integer.

for i in range(77, 79):
    print(resp[i], type(resp[i].change_event.change_resource_type))

change_event {
  resource_name: REDACTED
  change_date_time: "2021-08-10 14:53:41.951903"
  change_resource_type: AD
  change_resource_name: REDACTED
  user_email: REDACTED
  resource_change_operation: UPDATE
  changed_fields {
    paths: "added_by_google_ads"
    paths: "final_url_suffix"
  }
}
 <enum 'ChangeEventResourceType'>

change_event {
  resource_name: REDACTED
  change_date_time: "2021-08-10 14:54:43.407839"
  change_resource_type: 14
  change_resource_name: REDACTED
  user_email: REDACTED
  resource_change_operation: CREATE
  changed_fields {
    paths: "id"
    paths: "name"
    paths: "resource_name"
  }
}
 <class 'int'>

Not sure if I'm missing an update somewhere or if something else is going on. Any guidance would be appreciated. Thanks.

Google Ads API Forum Advisor

unread,
Sep 1, 2021, 10:07:02 PM9/1/21
to sc...@lionhurst.com, adwor...@googlegroups.com

Hello Scott,

Thank you for reaching out to us.

So our team can better check, can you share to us the following details below?

You can enable the logging by following this guide.

Please send the requested details via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Regards,

Google Logo
Mark Kevin Albios
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Mk4KF:ref

Mario

unread,
Sep 16, 2021, 12:59:34 AM9/16/21
to AdWords API and Google Ads API Forum
Hi Mark,

I am facing the same issue as well.
When I try to get the  change_event.change_resource_type.name, it works for other enum values, except for the value 14, where I get the error:
AttributeError: 'int' object has no attribute 'name'

Is there any suggested fix for this issue yet?

Regards,
Mario

Mat

unread,
Sep 16, 2021, 11:21:27 AM9/16/21
to AdWords API and Google Ads API Forum
Hi Scott and Mario,

you need to upgrade to the latest version of the Python library (currently 14.0.0). Only this version supports Google Ads API v8_1.
But caution! Read this, before you upgrade:
New required use_proto_plus parameter in version 14.0.0

Regards
Mat

Google Ads API Forum Advisor

unread,
Oct 19, 2021, 12:50:35 AM10/19/21
to m...@keyword-experte.de, adwor...@googlegroups.com
Hi All,

@Mat, thank you for providing your insights here.

@Mario, could you confirm if you already tried the suggestion provided by Mat? I asked because, it appears that the issue can be resolved by upgrading to the 14.0.0 version of the Python library as suggested by Mat and also the workaround tried by Scott (initial user of this forum post) to address the issue. Since the issue is more client library specific, then I would also suggest reaching out to the author of the Python client library via this link as they are more equipped to provide support to this topic.

However, if the issue persists, could you provide the complete request and response logs with request ID and request header generated on your end where we can see the issue so that our team can help in addressing it?

You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Mk4KF:ref
Reply all
Reply to author
Forward
0 new messages