Reputation: 476
Is it possible to query against multiple kinds (I am using NDB models) with one query?
I am trying to build a forum-like message feed where you can post a normal forum type comment, but also other things like photos, polls, etc.
I would have all these feed items belong to a common ancestor (the page they belong to) and query against that, but I believe that would greatly limit the write throughput.
So I need to be able to query all of the page's feed items in one query, and would like to use separate models (if possible). I can make some fake models within the app to achieve this (and use just one gae kind for all types), but was wondering if anyone had any other ideas.
Thank you very much
Upvotes: 1
Views: 369
Reputation: 21835
You should use the PolyModel
class:
The PolyModel class is the superclass for data model definitions that can themselves be superclasses for other data model definitions. A query produced from a PolyModel class can have results that are instances of the class or any of its subclasses.
Upvotes: 4