具有多个不等式的App Engine NDB查询? [英] App Engine NDB query with multiple inequalities?

查看:84
本文介绍了具有多个不等式的App Engine NDB查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里唯一的两个答案涉及重组数据库以适应此限制,但我不确定如何在我的情况下这样做。



我有一个列表成千上万的联系人,每个联系人都有许多属性。我正在创建一个能够一次过滤多个属性的页面。



例如:Age< 15,添加日期> 15天前,地点==圣克鲁斯等。可能需要大量的不平等过滤器。如何在GAE中实现这一目标?

根据 docs(用于python)
$ b


限制:数据存储对查询实施一些限制。
违反这些规定会导致异常。例如,
结合了太多的过滤器,对多个
属性使用不等式,或者将不等式与
不同属性上的排序顺序组合在一起,目前都不允许使用。同时过滤
引用多个属性有时需要配置二级索引到


如果您在几个月,这可能会改变。 GAE不断变化。



现在,您必须进行多个查询并将它们组合到您的代码中。


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?

解决方案

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.

这篇关于具有多个不等式的App Engine NDB查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆