Use an ancestor query 

https://developers.google.com/appengine/docs/python/ndb/queries#ancestor

On Wednesday, June 26, 2013 7:48:42 AM UTC+8, Pumplerod wrote:
>
> put another way...
>
> If I have a list "members" which are all of class ItemIndex, can I search 
> through and pull out just the ones who's parent is of a given "type" 
> without having to use a loop?
>
> On Tuesday, June 25, 2013 4:45:15 PM UTC-7, Pumplerod wrote:
>>
>> I have this type of Model...
>>
>> class Item(ndb.Model):
>>     type = ndb.StringProperty(indexed=True)
>>     parameters = ndb.JsonProperty()
>>
>> class ItemIndex(ndb.Model):
>>     members = ndb.KeyProperty(repeated=True)
>>
>> When I create an Item I also create an ItemIndex with it's parent set to 
>> be the Item.key
>>
>> I would like to be able to look through all the ItemIndex instances and 
>> find one that has a particular member but whose parent is of a certain 
>> type.  Ideally something like...
>>
>> ItemIndex.query(parent.type == 'Target' and ItemIndex.key.IN(ndb.Key(
>> 'ItemIndex'))).fetch()
>>
>> I'm sure I've butchered even my ideal example.  But is there a way to 
>> traverse through the query similar to the way I might structure a gremlin 
>> query to find a deeply nested item?
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to