在应用引擎数据存储中查询缺少属性的实体? [英] Querying for entities with missing properties in app engine Datastore?

查看:118
本文介绍了在应用引擎数据存储中查询缺少属性的实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  class示例(db.Model):
row_num = db.InteProProperty(required = True)
updated = db.IntegerProperty()
...
...

现在,当我存储值时,我可能无法每次填充更新属性的值,这意味着在某些实体中它可能不存在。



我想构建一个数据存储查询,以便我可以获取没有属性更新集的所有类实例。



我该怎么做?

p.s。我知道我可以设置一个默认值,然后查询它。但问题是我有超过300万个实体,并且更新将仅标记为1%,因此我不想通过将其余的设置为0来浪费太多的数据存储空间。


<在GQL中,没有属性值的对象不能通过该属性的查询返回,所以如果没有默认值,你所要求的是不可能的 b
参考资料:此页面


I have a model which looks like this:

class Example (db.Model) :
 row_num = db.IntegerProperty(required=True)
 updated = db.IntegerProperty()
 ...
 ...

Now when i store values, I may not fill the value for the updated property every time, which implies that in some entities it may not exist.

I want to construct a datastore query so that i can get all entities of kind Example which do not have the property updated set.

How do i do this?

p.s. i know i can set a default value and then query on it. But the issue is i have over 3 million entities and updated will be marked only for 1% of them, so i do not want to waste so much of datastore space by setting the rest to 0.

解决方案

In GQL, objects which do not have a value for a property cannot be returned by queries on that property, so what you're asking for is impossible without a default value.

Reference: section headed "Entities Without a Filtered Property Are Never Returned by a Query" on this page.

这篇关于在应用引擎数据存储中查询缺少属性的实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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