File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,10 @@ def projection(self, projection):
246246 projection = [projection ]
247247 self ._projection [:] = projection
248248
249+ def keys_only (self ):
250+ """Set the projection to include only keys."""
251+ self ._projection [:] = ['__key__' ]
252+
249253 @property
250254 def order (self ):
251255 """Names of fields used to sort query results.
Original file line number Diff line number Diff line change @@ -250,6 +250,12 @@ def test_projection_setter_multiple_calls(self):
250250 query .projection = _PROJECTION2
251251 self .assertEqual (query .projection , _PROJECTION2 )
252252
253+ def test_keys_only (self ):
254+ _KIND = 'KIND'
255+ query = self ._makeOne (_KIND )
256+ query .keys_only ()
257+ self .assertEqual (query .projection , ['__key__' ])
258+
253259 def test_order_setter_empty (self ):
254260 _KIND = 'KIND'
255261 query = self ._makeOne (_KIND , order = ['foo' , '-bar' ])
You can’t perform that action at this time.
0 commit comments