views:

60

answers:

1

If I have a class that has a back reference (eg something_set), how do I query for keys only on that set? The Query() constructor allows you to do this by settings keys_only=True, but as far as I can tell, filtering directly on the back reference always de-references the entities when it returns them.

+3  A: 

You can't - keys_only needs to be set when the Query is constructed, and that's already done for you when you access something_set.

That said, foo.bar_set is just Syntactic sugar for:

q = Foo.all().filter('bar =', foo_instance)

So you can do that and use the keys_only operator in the all() method.

Nick Johnson
Thanks - That's what I thought, just wanted to verify.
Shaun Budhram