App Engine NDB query with multiple inequalities?

☆樱花仙子☆ 提交于 2019-12-06 10:03:26

问题


The only two answers on here involve essentially restructuring the database to accommodate this limitation, but I am unsure how to do that in my case.

I have a list of thousands of contacts, each with many many properties. I'm making a page that has an ability to filter on multiple properties at once.

For example: Age < 15, Date Added > 15 days ago, Location == Santa Cruz, etc. Potentially a ton of inequality filters required. How does one achieve this in GAE?


回答1:


According to the docs (for python),

Limitations: The Datastore enforces some restrictions on queries. Violating these will cause it to raise exceptions. For example, combining too many filters, using inequalities for multiple properties, or combining an inequality with a sort order on a different property are all currently disallowed. Also filters referencing multiple properties sometimes require secondary indexes to be configured.

If you check back in a few months, this may change. GAE keeps changing pretty quickly.

For now, though, you'll have to make multiple queries and combine them in your code.



来源:https://stackoverflow.com/questions/16114762/app-engine-ndb-query-with-multiple-inequalities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!