在 Google App Engine 中选择数据存储 ID?
我正在尝试进行一个查询,选择 id 为 6 的所有内容。问题是我似乎无法让它工作。这就是代码目前的样子:
query = db.GqlQuery("SELECT * FROM Users WHERE id = 6")
result = query.get()
for result in query:
self.response.out.write(result.username)
没有错误或任何东西,但它只是不会输出用户名。有人以前遇到过这个问题或者知道我做错了什么吗?
I'm trying to make a query that selects everything where the id is 6. The problem is that I cant seem to get it to work. This is what the code looks like at the moment:
query = db.GqlQuery("SELECT * FROM Users WHERE id = 6")
result = query.get()
for result in query:
self.response.out.write(result.username)
Theres no errors or anything but it just wont output the username. Has anyone had this problem before or know what I did wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用数据存储分配的
id
值,则只能有一个具有给定 ID 的实体。这个怎么样:
If you're using the
id
value assigned by the datastore, there can only be a single entity with a given id.How about this instead: