Skip to content

Commit

Permalink
Add keys function to Query.
Browse files Browse the repository at this point in the history
  • Loading branch information
adieu committed Dec 26, 2014
1 parent b343acf commit 5bbf856
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gcloud/datastore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ def projection(self, projection=None):
clone._pb.projection.add().property.name = projection_name
return clone

def keys(self):
"""Adds a projection to get keys only
:rtype: :class:`Query`
:returns: A new Query instance only returns entity keys
"""
return self.projection(['__key__'])

def offset(self, offset=None):
"""Adds offset to the query to allow pagination.
Expand Down

0 comments on commit 5bbf856

Please sign in to comment.