views:

56

answers:

1

This is a follow-up question to Drew Sears' answer to this discussion:

http://stackoverflow.com/questions/3314721/app-engine-datastore-data-model-question

If I model bucket as a reference property in the object kind and say I want to query for objects in bucket 1234 with size > 1000. My query will look like "where bucket = key('Bucket', 1234) and size > 1000".

I'm assuming that this will require a custom index on the bucket and size properties. Is that assumption wrong? If not, is Model #2 in the original question (dynamic kinds) the only way to make it work with automatic indexes? I hope there's another way.

Thanks, Keyur

+1  A: 

You're correct: This will require a custom index. Dynamic kinds would be one way around this - though a kludgy one - but there may be others. Can you tell us more about the structure of these entities, the kinds of properties users can declare, and valid queries on those properties?

Nick Johnson
Bucket owners define the structure of objects in that bucket. Example object structures: (name, size), (name, length, description, read_only), etc. Example queries: size > 1000 (on the 1st structure), length > 1000 (2nd structure), read_only = false (2nd structure again)
Keyur
But only ever one filter on one property in a bucket?
Nick Johnson
Yes. If ever I filter on more than one I'll either apply a secondary filter in memory or issue 2 queries.
Keyur