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,
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.