Thanks Ben, that sounds great. I'm excited to hear what you guys come up with! Just let me know when a decision has been reached. Thanks again.
________________________________ From: adwordsapi-supp...@google.com <adwordsapi-supp...@google.com> Sent: Wednesday, February 27, 2019 6:33:16 AM To: Philip Stefou Cc: AdWords API and Google Ads API Forum Subject: RE: [3-5796000025195] Can a row count be obtained without iterating through all rows Hi Phil, Just to let you know we're investigating some possible solutions to this issue. It seems really useful to be able to access the raw response in addition to the results, so it's possible this may be fixed in the Python client lib. I'm not sure what the timetable will be, but once I have more details I'll follow up to let you know. Thanks again for bringing this to our attention! Best, Ben, AdWords API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 02/25/19 16:05:11 pste...@wordstream.com wrote: Thanks Ben, we would be using this in a production environment so I would rather hold out for a more publicly documented solution just due to the fact that this could easily disappear without warning. I appreciate you having looked into it, please do let me know though if this functionality does become official. Thanks. ________________________________ From: adwordsapi-supp...@google.com <adwordsapi-supp...@google.com> Sent: Tuesday, February 26, 2019 5:06:22 AM To: Philip Stefou Cc: AdWords API and Google Ads API Forum Subject: RE: [3-5796000025195] Can a row count be obtained without iterating through all rows Hi Phillip, So GAQL unfortunately does not support a COUNT function as we hoped. There is, however, a way to get this information from the raw response message returned from the API. The problem is that retrieving it involves using some private attributes on the Iterator instance returned by GoogleAdsService.search: 1. Set your query to LIMIT = 1 to return the minimum number of results. 2. Once you get the Iterator instance from the .search method you can get the raw response with: * raw_response = iterator._method(iterator._request) 3. Then raw_response.total_results_count will have the total number of rows. Since this solution relies on private methods on the Iterator I would not recommend using it for anything other than experimentation. I asked our gRPC team if there's a better way to get the response and I'll let you know if there is. If not, depending on your use-case, there may be other ways to work around this. Let me know if you have any questions, otherwise I'll follow up once I have more information from gRPC. Thanks, Ben, AdWords API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 02/25/19 11:08:41 adwordsapi-supp...@google.com wrote: Hi Philip! Thanks for reaching out with this question. I believe a COUNT-like function would need to be supported by GAQL and wouldn't necessarily be exposed via the client libraries. In Python the iterator object returned by search does have a num_results property, but I think it may only refer to the current page, and also seems to be 0 until the page is actually requested. It also looks like the Java sample mentioned in this thread must retrieve a response before it can retrieve num results. I'll double-check whether there is a way to retrieve only row counts in GAQL, and will also see if there's something fancy that can be done with the GRPCIterator in Python. I'll get back to you as soon as possible once I get some more information. Thanks, Ben, AdWords API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 02/21/19 18:31:46 pste...@wordstream.com wrote: Can you provide a python example of this functionality? From what I can tell this does not exist in the Python client library. There is only a .search method on the GoogleAdsService which does accept a page_size argument, however the response is still a generator of the page of data. Let me know, thanks. ________________________________ From: adwordsapi-supp...@google.com <adwordsapi-supp...@google.com> Sent: Friday, February 22, 2019 7:00:50 AM To: Philip Stefou Cc: AdWords API and Google Ads API Forum Subject: RE: Can a row count be obtained without iterating through all rows Hello Philip, Could you please try the below snippet which will give you the entire results that can be fetched via the Query irrespective of the Page size and limit mentioned. Please give it try and let me know if you still have any further questions. Snippet below: searchPagedResponse.getPage().getResponse().getTotalResultsCount()); Regards, Sai Teja, Google Ads API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 02/11/19 18:32:25 pste...@wordstream.com wrote: Thanks a lot, I appreciate that. ________________________________ From: adwordsapi-supp...@google.com <adwordsapi-supp...@google.com> Sent: Tuesday, February 12, 2019 8:01:13 AM To: Philip Stefou Cc: AdWords API and Google Ads API Forum Subject: RE: Can a row count be obtained without iterating through all rows Hello Philip, I have passed your suggestion to the team and I will update you once I have more information. Meanwhile, you could keep an eye on our blog<https://ads-developers.googleblog.com/search/label/google_ads_api> for information related to the future releases. Regards, Sai Teja, Google Ads API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 02/11/19 16:30:28 pste...@wordstream.com wrote: Thanks for the follow-up, unfortunately this will still involve pulling the result set over the network. We'll have to think of something else. Thanks. ________________________________ From: adwordsapi-supp...@google.com <adwordsapi-supp...@google.com> Sent: Tuesday, February 12, 2019 2:09:33 AM To: Philip Stefou Cc: AdWords API and Google Ads API Forum Subject: RE: Can a row count be obtained without iterating through all rows Hello Philip, It is the total number of elements in the response page. As a workaround you could remove the PAGE_SIZE in your request(don't set PAGE_SIZE), so that the entire result set will be in a single page and then the number of rows in the response will be equal to the number of elements in the page. Code snippet in Java: searchPagedResponse.getPage().getPageElementCount(); Please let me know if you have any further questions. Regards, Sai Teja, AdWords API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 02/08/19 16:07:18 pste...@wordstream.com wrote: Thanks for the reply, does this give the row count of the total number of rows that would be returned by the query or just the rows on the page? The problem I'm trying to solve is obtaining a total count of all rows that would be returned by a given query, without the need to pull all the data over the network. Let me know what you think, thanks again. On Saturday, February 9, 2019 at 5:59:35 AM UTC+9, googleadsapi-forumadvisor wrote: Hello Phil, To get the count of the rows without iterating you could use the below code code snippet for Java. You could use the similar functionality in other client libraries as well to get the count of the results. Also, the PAGE_SIZE attribute can be mentioned for the search query to get not more than that many results in the response. You could refer our sample code to get campaigns in Java here<https://github.com/googleads/google-ads-java/blob/master/google-ads-examples/src/main/java/com/google/ads/googleads/examples/basicoperations/GetCampaigns.java#L97> for reference, code samples in other languages can be found here<https://developers.google.com/google-ads/api/docs/client-libs>. Code snippet in Java: searchPagedResponse.getPage().getPageElementCount(); Please let me know if you have any further questions. Regards, Sai Teja, Google Ads API Team =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://googleadsdeveloper.blogspot.com/search/label/adwords_api https://developers.google.com/adwords/api/community/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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=3-5796000025195&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/ -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/f195128e-b692-4922-aa51-3a8168ade889%40googlegroups.com<https://groups.google.com/d/msgid/adwords-api/f195128e-b692-4922-aa51-3a8168ade889%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/MN2PR06MB582182CE8CD4E30301A0393BC97B0%40MN2PR06MB5821.namprd06.prod.outlook.com. For more options, visit https://groups.google.com/d/optout.