1

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?

cjlallana
  • 636
  • 4
  • 12

1 Answers1

3

The GAE datastore is not a relational model. You cannot do joins. You would need to iterate through each course to get its applications.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • If its a query you perform a lot, then store the country as redundant copy in the Application as an application can only refer to one course, and the course is explicity referencing a country. – Tim Hoffman Apr 26 '13 at 11:23