Count GQL

2,013 views
Skip to first unread message

Martin Descours

unread,
Oct 16, 2013, 11:56:52 AM10/16/13
to google-a...@googlegroups.com
I am sure you had that a lot, but how can count results on a request via GQL on AppEngine DataViewer ?
It seems that there is no easy way to have the answer and i get crazy about it...
because i am no developper

is it sth like :
SELECT COUNT(*) FROM Database
or
COUNT (SELECT * FROM...)

?

Is Google App Evil ?
thx for ur help !

M.

timh

unread,
Oct 16, 2013, 7:04:23 PM10/16/13
to google-a...@googlegroups.com
You can't

You have stop thinking of appengine/gql in SQL terms.

Use the remote_api shell, then you can get the query object and then call count() on it.

Vinny P

unread,
Oct 16, 2013, 10:41:03 PM10/16/13
to google-a...@googlegroups.com
On Wed, Oct 16, 2013 at 6:04 PM, timh <zute...@gmail.com> wrote:
You have stop thinking of appengine/gql in SQL terms.


+1

On Wed, Oct 16, 2013 at 10:56 AM, Martin Descours <descour...@gmail.com> wrote:
I am sure you had that a lot, but how can count results on a request via GQL on AppEngine DataViewer ?


If you really want to use COUNT and other SQL commands, migrate your data to the Cloud SQL service: https://developers.google.com/cloud-sql/docs/dev-access

 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com
 

Martin Descours

unread,
Oct 17, 2013, 4:37:21 AM10/17/13
to google-a...@googlegroups.com
thx
!


2013/10/17 timh <zute...@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/mv55_PZUu80/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Rafael

unread,
Oct 17, 2013, 8:10:24 PM10/17/13
to google-appengine
I always wondered if we have access to the "Datastore Statistics" from code. Maybe that's enough for him?

thanks
rafa


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.

Vinny P

unread,
Oct 17, 2013, 11:43:29 PM10/17/13
to google-a...@googlegroups.com
On Thu, Oct 17, 2013 at 7:10 PM, Rafael <mufu...@gmail.com> wrote:
I always wondered if we have access to the "Datastore Statistics" from code. Maybe that's enough for him?

 

Yes it's possible, the datastore stats are collated from the metadata. See here:


But there is no direct equivalent to count subsets of entities - for example in SQL you can do SELECT COUNT(*) FROM customers WHERE name="bob" (counting the subset of records that contain the given name), while that's not possible in GQL. 
Reply all
Reply to author
Forward
0 new messages