Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As it's stated in <a href="https://stackoverflow.com/questions/739220/does-gql-support-commonly-available-sql-style-aggregation">other</a> <a href="https://stackoverflow.com/questions/421751/whats-the-best-way-to-count-results-in-gql">questions</a>, it looks like there is no <code>count</code> aggregate function in GQL. The <a href="http://code.google.com/appengine/docs/python/datastore/gqlreference.html" rel="nofollow noreferrer">GQL Reference</a> also doesn't say there is the ability to do this, though it doesn't explicitly say that it's not possible.</p> <p>In the development console (running your application locally) it looks like just clicking the "List Entities" button will show you a list of all entities of a certain type, and you can see "Results 1-10 of (some number)" to get a total count in your development environment.</p> <p>In production you can use the "Datastore Statistics" tab (the link right underneath the Datastore Viewer), choose "Display Statistics for: (your entity type)" and it will show you the total number of entities, however this is not the freshest view of the data (updated "at least once per day").</p> <p>Since you can't run arbitrary code in production via the browser, I don't think saying "use <code>.count()</code> on a query" would help, but if you're using <a href="http://code.google.com/appengine/articles/remote_api.html" rel="nofollow noreferrer">the Remote API</a>, the <code>.count()</code> method is <a href="https://stackoverflow.com/questions/264154/google-appengine-how-to-fetch-more-than-1000/3543527#3543527">no longer capped at 1000 entries as of August, 2010</a>, so you should be able to run <code>print MyEntity.all().count()</code> and get the result you want.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload