Hi Nicholas,

Your query appears to be correct as I tried it locally using my test
account. The deadline error might indeed be due to a the volume of data you
are extracting. However, to have a closer look at the issue as to why you
are getting the deadline error, could you provide your clientCustomerId?
Also, could you confirm as well how many reports you have already generated
when you started encountering the said error?

You may reply to me via the *Reply privately to author* option.

Thanks and regards,
Peter
Google Ads API Team

On 04/24/19 22:39:46 nlynch...@gmail.com wrote:


How do you pull a list of segment.geo_target_region for USA physical
location?
*    AND geographic_view.country_geo_target_constant =
'geoTargetConstants/2840'*
* AND geographic_view.location_type = 'LOCATION_OF_PRESENCE'*

I am trying to pull all of the *geo_target_region * names for the physical
locations within the USA, specifically just 9 states where I tried the
following code, but still received a deadline error.

_DEFAULT_PAGE_SIZE = 1000

def geo_costs(client, customer_id):
    ga_service = client.get_service('GoogleAdsService', version='v1')

    query = ('''SELECT
     segments.geo_target_region
FROM
geographic_view
WHERE
customer.id = XXXXXX
    AND geographic_view.country_geo_target_constant =
'geoTargetConstants/2840'
AND geographic_view.location_type = 'LOCATION_OF_PRESENCE'
LIMIT
100''')


    response = ga_service.search(customer_id, query)
    for row in response:
        print(row.segments.geo_target_region.resource_name)

geo_costs(client,customer_id)






On Tuesday, April 23, 2019 at 10:36:14 PM UTC-5, googleadsapi-forumadvisor
wrote:

Hi Nicholas,

Yes, when using the week segment, the input should be the date of the
Monday of the week you wish to retrieve and runs the date range until
Sunday. Parsing the results does not influence the error you are
encountering, it is more likely due to the volume of data being retrieved.
As for using the geographic_view.country_geo_target_constant as predicate,
the value you input can be derived from this documentation
<https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v1.resources#geographicview> of
the resource.

Also, you are getting the (*RequestId: TG0jUIGkLfxwFgMeCKdy2g, IsFault:
True, FaultMessage: The following pairs of fields may not be selected
together: 'segments.geo_target_region' and 'segments.date'*) error because
the 2 fields indicated in the error string are not selectable in the same
query.

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 22:46:36 nlyn...@gmail.com wrote:

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 nlyn...@gmail.com 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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/ms
gid/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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
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
<https://groups.google.com/d/msgid/adwords-api/b98167a2-4c5d-4bb2-a22f-7797e7cec5a0%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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
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/5189431d-f0a9-4c76-a5d1-b9bbab47ce89%40googlegroups.com
<https://groups.google.com/d/msgid/adwords-api/5189431d-f0a9-4c76-a5d1-b9bbab47ce89%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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
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/00d12hu6r80000010vq15s003494f6x6gmjge9l6go30c1g68r30dpo%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • python ... Nicholas Lynch
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... Nicholas Lynch
        • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
          • ... Nicholas Lynch
            • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to