Although having a "parentKey" is redundant, that's the beauty of denormalization in non-relational datastore. It's easier and it doesn't take much to do. (ie in non-relational datastore logic should be done on writes not on reads if it can be helped). hehe... I'm not biased at all :)
About the entity group thing. I'm sure the entity-group arrangements will stick around. Schema change isn't the issue though. I ran into a problem with datastore writes. There is a limit on writes within an entity group, (about 10 per second). So if you have a lot of children and you want to update 100 of them and they are in the same entity group, guess what happens. If you're aware of that, that's fine, just wanted to point that out. It was a surprise to me, but it's something Max Ross brought up in Google I/O presentations. Cheers! On Mar 18, 9:56 am, tempy <[email protected]> wrote: > That's a good point, but in this case the resulting entity group > arrangement is intentional. Lock-in isn't a worry, I can confidently > say that these entity-group arrangements will last as long as the > application does. > > Though, as you point out, I can make a "parentKey" field on the child, > but since this parent key will also have to appear within the child's > key, having such a field is redundant and I would rather avoid it. > > On Mar 18, 3:51 pm, Tristan <[email protected]> wrote: > > > > > Something you may want to consider is that you are placing yourself > > within the limitations of entity groups by sticking children under > > parent keys. You may want to consider a model where the parent key is > > simply a field in the child and then run a simple query testing that > > the "parentKey" field is equal to the one you're looking for. This > > makes queries easier and prevents entity group lock-in. > > > Cheers! > > > On Mar 18, 8:55 am, tempy <[email protected]> wrote: > > > > I want to retrieve all entities that are children of one other > > > particular entity, by checking if the parent-key property of the > > > child's key matches the parent key. I have a reference to the parent > > > entity but I want to avoid loading all of its children (as there may > > > be many children, but I only need a few). Thus I want a query that > > > looks something like this: > > > > query = pm.newQuery("select from " + ChildClass.class.getName() + > > > " where :parentID.contains(ChildIDProperty.ParentID) && > > > SomeOtherProperty > " + filterString); > > > > But I'm not sure how to exactly address the parent key property of a > > > key in a query. > > > > Thanks, > > > Mike -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
