Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The behavior of <a href="http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_count" rel="noreferrer"><code>Query.count()</code></a> is inconsistent with the documentation when no limit is explicitly specified - the documentation indicates that it will count "until it finishes counting or times out." GAE <a href="http://code.google.com/p/googleappengine/issues/detail?id=3671" rel="noreferrer">Issue 3671</a> reported this bug (about 3 weeks ago).</p> <p><strong>The workaround</strong>: explicitly specify a limit and then that value will be used (rather than the default of 1,000).</p> <p>Testing on <a href="http://shell.appspot.com/" rel="noreferrer">http://shell.appspot.com</a> demonstrates this:</p> <pre><code># insert 1500 TestModel entites ... # ... &gt;&gt;&gt; TestModel.all(keys_only=True).count() 1000L &gt;&gt;&gt; TestModel.all(keys_only=True).count(10000) 1500L </code></pre> <p>I also see the same behavior on the latest version of the development server (1.3.7) using this simple test app:</p> <pre><code>from google.appengine.ext import webapp, db from google.appengine.ext.webapp.util import run_wsgi_app class Blah(db.Model): pass class MainPage(webapp.RequestHandler): def get(self): for i in xrange(3): db.put([Blah() for i in xrange(500)]) # can only put 500 at a time ... c = Blah.all().count() c10k = Blah.all().count(10000) self.response.out.write('%d %d' % (c,c10k)) # prints "1000 1500" on its first run application = webapp.WSGIApplication([('/', MainPage)]) def main(): run_wsgi_app(application) if __name__ == '__main__': main() </code></pre>
    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