views:

27

answers:

1

for example, 2 classes in a 1-to-many relationship:

class owner(db.model):
    name = db.StringProperty()

class cat(db.model):
    name = db.StringProperty()
    owner = db.ReferenceProperty(owner)

so how do i produce a list of cats ordered by owner.name (then optionally by cat.name)?

i tried "SELECT * FROM cat ORDER BY owner.name" but got Parse Error: Expected no additional symbols at symbol .name

Thanks

+3  A: 

You can't; this would require a join, which the datastore doesn't support. If you need to sort like this, denormalize your data and include the owner name in the cat model.

Wooble