简体   繁体   English

我怎样才能获得一系列的收藏品

[英]How can I get a collection of collection

I have these models: 我有这些模型:

class Country(db.Model):
    name    = db.StringProperty()
    code    = db.StringProperty()

class Course(db.Model):
    name          = db.StringProperty()
    description   = db.StringProperty()
    country       = db.ReferenceProperty(Country, collection_name='courses')

class Application():
    status    = db.StringProperty()
    course    = db.ReferenceProperty(Course, collection_name='applications')

One country has many courses, and one course has many applications. 一个国家有很多课程,一门课程有很多应用。 So how can I get a query with all the applications from a country? 那么如何才能获得来自某个国家/地区的所有应用程序的查询? Is it even possible? 它甚至可能吗?

The GAE datastore is not a relational model. GAE数据存储区不是关系模型。 You cannot do joins. 你不能做连接。 You would need to iterate through each course to get its applications. 您需要遍历每个课程以获取其应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM