Skip to content

Instantly share code, notes, and snippets.

@patkujawa-wf
Created December 30, 2014 19:04
Show Gist options
  • Save patkujawa-wf/45288cbb9ff704410d78 to your computer and use it in GitHub Desktop.
Save patkujawa-wf/45288cbb9ff704410d78 to your computer and use it in GitHub Desktop.
Projection query example in google app engine
# Taken from http://ae-book.appspot.com/static/pgae-ndb-20121009.pdf
# Video at https://www.youtube.com/watch?v=xZsxWn58pS0#t=2970
query = Player.query()
results = query.fetch(20,
projection=[Player.name, Player.level])
for player in results:
# player.name ...
# (player.score not set)
# Projected property values are pulled directly from
# the index, and so must all be indexed properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment