문제

I have two entity kinds in my python GAE app - both with similar attributes - and I'd like to query both lists and order the result according to an attribute common to both kinds. So something along the lines of:

db.GqlQuery("SELECT * FROM Video1, Video2 ORDER BY views DESC").fetch(1000)

Can I do this in GQL directly?

도움이 되었습니까?

해결책

No. You need to run two queries, one for each kind.

Check out the GQL and GqlQuery class references.

You can actually do a kindless query using db.GqlQuery('SELECT') to fetch everything. However, you can not filter or order it (other than by key).

edit:

You may want to check out PolyModel.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top