使用 GQL 处理名称中包含点 (.) 的列
我在 GAE/Java 应用程序中使用 Objectify 进行数据存储操作。我在项目中的几个地方使用了 Objectify 的 @Embeded 工具。 Objectify 自动展平实体内由 @Embeded 表示法标记的嵌套对象。分隔符。因此,我最终得到了像entity.embededObject.Field这样的列名称,
例如,我的数据存储中有一个实体“Person”,其中有两列name
和address.email
。
我想通过编写简单的 GQL 查询来过滤数据存储查看器中的 Person。 但以下查询因语法错误而失败:
SELECT * FROM Person where address.email='[email protected]'
而以下查询应正常工作
SELECT * FROM Person where name='Joe'
我做错了什么?
I use Objectify for datastore operations in my GAE/Java application. I have used Objectify's @Embeded facility in a couple of places in my project. Objectify automatically flattens the nested objects within the entity marked by @Embeded notation using the . separator. Thus I have ended up with column names like entity.embededObject.Field
For example I have an entity 'Person' in my data store with two columns name
and address.email
.
I want to filter through Person in the datastore viewer by writing a simple GQL query.
But the following query fails with a syntax error:
SELECT * FROM Person where address.email='[email protected]'
whereas the following works as it should
SELECT * FROM Person where name='Joe'
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GQL 目前不支持此功能 - 仅支持“单词”字符。您绝对应该将此问题作为错误提交到问题跟踪器中。
GQL currently doesn't support this - only 'word' characters are supported. You should definitely file this as a bug in the issue tracker.
今天经过测试,可以使用反引号运行以下命令,
我相信这对于任何参数都适用,但如果我错了,请纠正我。
Tested today, it is possible to run the following with backquotes
I believe this holds true for any parameter, but please correct me if I am wrong.