我的账户是
class TwAccount(ndb.Model):
100 different properties here
error = ndb.IntegerProperty(repeated=True)
我试着:
twaccount_dbs = model.TwAccount.query().filter(ndb.GenericProperty('followuserfollowme') == True)
但我只想查询一个属性。
twaccount_dbs = model.TwAccount.query().filter(ndb.GenericProperty('followuserfollowme') == True).fetch(projection=["error"])
然后返回0个实体。
我试过了
twaccount_dbs = model.TwAccount.query().filter(ndb.GenericProperty('followuserfollowme') == True).fetch(projection=[model.TwAccount.error])
但它也返回0个实体
我希望它返回一个实体。
更新1:
我发现如果错误是emtpy(所以不存在),那么投影查询将返回0
我想使用投影查询来节省阅读成本。不可能吗?