hi mike! there are a couple things going on here. first, your all().filter() example returns no results because there's no space between ancestor and =, so it thinks you're filtering on a property named 'ancestor='. the docs note that you need a space before the filter operator: http://code.google.com/appengine/docs/datastore/queryclass.html#Query_filter . also see http://code.google.com/p/googleappengine/issues/detail?id=688 . try adding a space.
as for the GQL queries, the catch is the confusion between your ancestor parent and the ancestor query feature. specifically, ANCESTOR is a reserved keyword in GQL, and it always expects a valid, non-null key as its argument, which is why you get the GQL errors. On Mar 28, 2:40 am, Mike <i...@michaelwirth.me> wrote: > Hello, > > I'm playing around with AppEngine and seem to get around many of its > restrictions after some time. But now I'm stuck on this issue for > several hours: > I have a tree of groups. Every group has several sub-groups etc. The > whole thing is stitched together with a SelfReferenceProperty called > ancestor, so every group knows its parent. > However, the top group(s) have a <null> value for the field ancestor > (which I can see in the Data Viewer). In the group viewer I want to > show the top level groups if no id is provided. I have tried to query > for my groups with a null value the following ways, without success: > > groups = Group.all().filter('ancestor=', None) -> no results, no > error > > groups = db.GqlQuery("SELECT * FROM Group WHERE ancestor IS :1", db.Key > (None)) -> error: Incomplete key > > groups = db.GqlQuery("SELECT * FROM Group WHERE ancestor <") -> (I > found this in this group) error: Expected IS after ancestor > > Does anyone know how a (Self)ReferenceProperty can be queried for the > null value? It should be possible because the value is not missing, it > is just set to null. I am also open to other solutions for saving a > tree of objects in the datastore, which should be quite a common > problem. > > Thank you for your help! > Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---