python 的 Google 应用引擎中的 Expando 属性的自动索引
google app engine python sdk 提供了 Expando 类型对象,可用于向可持久保存到数据存储的对象添加动态属性。
应用程序引擎还要求,对于需要搜索或排序对象的任何属性,必须在将应用程序上传到谷歌服务器之前创建索引。这真的很奇怪,因为这意味着我应该事先知道我的用户将在我的对象上创建哪些属性。如果我事先知道这一点,为什么我不在现有模型中将它们定义为静态属性?
有谁知道如何在上传到应用程序引擎后自动为 Expando 模型的动态属性创建索引?如果没有,谁能告诉我为什么 gae 将 Expando 作为动态构造,因为它不允许您创建可搜索或排序的新属性,而只能创建不可搜索或可排序的属性。
The google app engine python sdk offers an Expando type object which can be used for adding dynamic properties to an object that can be persisted to the datastore.
The app engine also requires that for any property on which the objects need to be searched or sorted, an index must be created before uploading the app to google's servers. This is really strange because it means that i am supposed to know before hand what properties my users will create on my objects. If i knew that in advance, why would i not define them as static properties in my existing model?
Does anyone know how to automatically create indexes for dynamic properties of Expando models after uploading to the app engine? If not, can anyone tell me why does the gae tout Expando as dynamic construct when it can not let you create new properties that can be searched on or sorted by, only properties that arent searchable or sortable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所有属性都会自动索引以进行简单查询。在本例中,简单查询是指:
如果您想做更复杂的查询 - 例如混合不等式和等式过滤器的查询,那么您才需要构建自定义索引。
无法在运行时构建自定义索引。如果您想使用 Expandos,则需要确保将执行的查询限制为在上述情况之一下可满足的查询。
All properties are automatically indexed for simple queries. Simple queries, in this case, are those that either:
If you want to do more complex queries - such as ones that mix inequality and equality filters, only then do you need to build a custom index.
It's not possible to build custom indexes at runtime. If you want to use expandos, you need to make sure that you restrict the queries you execute to those that are satisfiable under one of the situations above.