What's the equivalent of Entity.all(keys_only=True).fetch(20) in NDB?
Asked Answered
W

1

10

How do I get the equivalent result of the following query in NDB?

Entity.all(keys_only=True).fetch(20)

I know you can pass 'keys_only=True' to the iter() method. But what if I want to perform a keys only fetch, how do I do that in NDB?

Womanlike answered 18/4, 2012 at 6:20 Comment(0)
W
14

Found it in the GAE NDB Docs. The answer is Entity.query().fetch(20,keys_only=True).

Womanlike answered 18/4, 2012 at 6:32 Comment(2)
Also check the "cheat sheet": docs.google.com/document/d/… -- It is really a conversion guide from db to ndb.Casady
Cool! Thanks for this! It took me a while to find the solution in the official docs, and it's not the same implementation as DB. Perhaps this could also be added to the cheat sheet. :)Womanlike

© 2022 - 2024 — McMap. All rights reserved.