您好我有这些模型:NDB查询与结构化propertiy和投影会出现意想不到的结果
class TagProprieta(ndb.Model):
tag = ndb.StringProperty()
stato = ndb.StringProperty()
class RegDevice(ndb.Model):
comune_key = ndb.KeyProperty()
reg_id = ndb.StringProperty()
tags = ndb.StructuredProperty(TagProprieta, repeated=True)
....
该查询返回预期的结果(有一些RegDevice对象列表):
registration_ids = models.RegDevice.query(\
models.RegDevice.comune_key==comune_key,\
models.RegDevice.tags == models.TagProprieta(tag=tag, stato='1')\
).fetch()
因为我只需要字段reg_id,然后我用这个更改了最后一行:
.fetch(projection=[models.RegDevice.reg_id])
结果是空的l IST:[]
我是完全正常的,如果我有和错误由于NDB的限制,但在我看来,和空单不corret。 我在做什么错?我唯一的机会使用前一个查询,然后处理内存中的结果? THX
Tryed,相同的结果之前:[],但THX – chairam
怎么样'投影= [RegDevice.reg_id]'? – GAEfan
或'projection = [“reg_id”]'? – GAEfan