GAE ancestor query without ancestor in the results

Ancestor queries in GAE can return the ancestor in the results:

  • when ancestor and query kind are the same, eg.:
    SomeModel.query(ancestor=some_key)
  • on kindless query, eg.:
    ndb.Query(ancestor=some_key)
  • To filter out ancestor instance from being fetched use filter on __key__:

    SomeModel.query(ancestor=some_key).filter(SomeModel.key > some_key)

    Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s