Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top