The segment.week just specifies the date period from that Monday to Sunday,
right?
Is there any issue in how I am parsing that response or is that irrelevant
for 504 deadline error?
I can try to predicate by segment.geo_target_region, but what is the best
way to pull those values? Because I do not think they are literal string
values like 'Florida, United States'. See attachment for desired data I am
trying to replicate for automated data pull.
Let me know if you need any additional information
If I try to run the following code that contains predicates, I receive the
following error: *RequestId: TG0jUIGkLfxwFgMeCKdy2g, IsFault: True,
FaultMessage: The following pairs of fields may not be selected together:
'segments.geo_target_region' and 'segments.date*' .
def geo_costs(client, customer_id):
ga_service = client.get_service('GoogleAdsService', version='v1')
query = ('''SELECT
segments.geo_target_region,
metrics.clicks,
metrics.cost_micros
FROM
geographic_view
WHERE
customer.id = XXXXXXXXXXXX
AND geographic_view.country_geo_target_constant =
'geoTargetConstants/2840'
AND geographic_view.location_type = 'LOCATION_OF_PRESENCE'
AND segments.date = '2019-04-15'
ORDER BY metrics.clicks DESC
LIMIT
100''')
response = ga_service.search(customer_id, query)
for row in response:
print(row.geographic_view.resource_name,",",row.metrics.clicks.value,"," ,
row.metrics.cost_micros.value)
geo_costs(client,'client_id')
On Tuesday, April 23, 2019 at 4:26:13 AM UTC-5, googleadsapi-forumadvisor
wrote:
>
> Hi Nicholas,
>
> I tried your GAQL queries using my test account and both are working
> correctly. The Deadline Exceeded error 504 that you are encountering might
> be due to the volume of data you are retrieving when using the *week*
> segment.
> I would recommend that you break down your report request by adding
> predicates or by just using the *date* segment to avoid this error.
>
> Thanks and regards,
> Peter
> Google Ads API Team
>
> Was your question answered? Please rate your experience with us by taking
> a short survey.
> If not -- reply to this email and tell us what else we can do to help.
>
> Take Survey
> <https://support.google.com/google-ads/contact/survey_transactional?caseid=4-8954000026078&hl=en&ctx=1>
>
> Also find us on our blog and discussion group:
> http://googleadsdeveloper.blogspot.com/search/label/adwords_api
> https://developers.google.com/adwords/api/community/
> On 04/23/19 05:50:08 [email protected] <javascript:> wrote:
>
>
> To whom it may concern,
>
> *What is the issue in my code or is there a way to extend the
> deadline/timeout?*
> I am trying to run a user location report by clicks,cost for Country:USA
> by states for 1 week.
>
> When I try to run a geographic view reports for clicks, cost by region by
> 1 week with the following code I receive a *deadline 504 error*, but I
> run the same code for no regions and 1 day it works in 2 seconds.
>
> See attached python scripts and code below for reference.
>
>
> '''SELECT
> segments.geo_target_region,
> metrics.clicks,
> metrics.cost_micros
> FROM
> geographic_view
> WHERE
> customer.id = XXXXXXXXXXX
> AND geographic_view.country_geo_target_constant =
> 'geoTargetConstants/2840'
> AND geographic_view.location_type = 'LOCATION_OF_PRESENCE'
> AND segments.week = '2019-04-15'
> ORDER BY metrics.clicks DESC
> LIMIT
> 100'''
>
> Even when I try to run the attached code for a week, I still receive a *504
> deadline error*.
>
> '''SELECT
> metrics.clicks,
> metrics.cost_micros
> FROM
> geographic_view
> WHERE
> customer.id = XXXXXXXXXX
> AND geographic_view.country_geo_target_constant =
> 'geoTargetConstants/2840'
> AND geographic_view.location_type = 'LOCATION_OF_PRESENCE'
> AND segments.week = '2019-04-15'
> ORDER BY metrics.clicks DESC
> LIMIT
> 100'''
>
>
>
> But I can run the following code without issue and it takes 2 seconds.
> '''SELECT
> metrics.clicks,
> metrics.cost_micros
> FROM
> geographic_view
> WHERE
> customer.id = XXXXX
> AND geographic_view.country_geo_target_constant =
> 'geoTargetConstants/2840'
> AND geographic_view.location_type = 'LOCATION_OF_PRESENCE'
> AND segments.date = '2019-04-15'
> ORDER BY metrics.clicks DESC
> LIMIT
> 100'''
>
>
> *python package version*: google-ads 1.3.1
>
> --
> --
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
> Also find us on our blog:
> https://googleadsdeveloper.blogspot.com/
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>
> You received this message because you are subscribed to the Google
> Groups "AdWords API and Google Ads API Forum" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/adwords-api?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "AdWords API and Google Ads API Forum" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/adwords-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/adwords-api/08697597-a5b9-40e0-8df5-78a6e56a02b3%40googlegroups.com
>
> <https://groups.google.com/d/msgid/adwords-api/08697597-a5b9-40e0-8df5-78a6e56a02b3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/b98167a2-4c5d-4bb2-a22f-7797e7cec5a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.