Python 2.7 NDB-查询属性的重复结构化属性
我有两种型号:Python 2.7 NDB-查询属性的重复结构化属性,python-2.7,google-app-engine,Python 2.7,Google App Engine,我有两种型号: class Author(ndb.Model): email = ndb.StringProperty(indexed=true) class Course(ndb.Model): student = ndb.StructuredProperty(Author, repeated=True) 我正在尝试查询课程,以查找学生的电子邮件与user.email\u地址的匹配位置。是否可以将其结构化为单个查询?您必须使用Author对象作为筛选器进行查询 query
class Author(ndb.Model):
email = ndb.StringProperty(indexed=true)
class Course(ndb.Model):
student = ndb.StructuredProperty(Author, repeated=True)
我正在尝试查询课程,以查找学生的电子邮件与user.email\u地址的匹配位置。是否可以将其结构化为单个查询?您必须使用Author对象作为筛选器进行查询
query = Course.query(Course.student.email == 'my@email.com')
但只有在查询单个属性时,此查询才是正确的。官方文件建议使用以下过滤器
query = Course.query(Course.student == Student(email='my@email.com'))
有关更多信息,请参见您必须使用Author对象作为筛选器进行查询
query = Course.query(Course.student.email == 'my@email.com')
但只有在查询单个属性时,此查询才是正确的。官方文件建议使用以下过滤器
query = Course.query(Course.student == Student(email='my@email.com'))
有关更多信息,请参见如果您也在查询结构化属性,请确保将索引添加到索引中。yaml如果不是自动生成的,请确保将索引添加到索引中。yaml如果不是自动生成的,请确保将索引添加到索引中