I have the following models, where one Thing
can have multiple Action
:
class Thing(polymodel.PolyModel):
create_date = db.DateTimeProperty(required=True)
class Action(db.Model):
thing = db.ReferenceProperty(Thing, collection_name='action')
action_by = db.StringProperty(required=True)
I need to use raw GQL to count the number of Thing
s that have no actions. It should be something like:
SELECT * FROM Thing WHERE action = []
I have the following limitations:
- I must use raw GQL (because the actual query contains DISTINCT which is not supported on a regular Query).
- I can't fetch the data and check the contents because I use remote api and would like only to count the data to save bandwith.
Can it be done?