0

我想使用 GQL 在 Google App Engine Datastore 中查找特定条目。

我要定位的实体是 webapp2 唯一用户记录。我尝试使用键、字符串等来构建查询,但没有成功。


编辑: 实体的模型是webapp2_extras.appengine.auth.models.Unique

使用webapp2_extras.appengine.auth.models.User类的属性插入唯一实体。它有一个 auth_id 属性,用于存储登录信息(“own”用于自定义登录,“google”或“yahoo”等用于 google 或 yahoo 用户名)、每个用户必须唯一的属性和自定义属性。

因此,如果用户的电子邮件和社会保险号必须是唯一的,则 auth_id、电子邮件和社会保险号的相应条目将在唯一中创建(前提是插入不会导致重复的实体)。这将导致实体:

name=User.auth_id:own:someusername@example.com
name=User.social_security_number:1234567890
name=User.email:someusername@example.com

我的一些尝试包括:

SELECT * FROM Unique where __key__ = KEY('name',User.auth_id:own:someusername@example.com)

或者

SELECT * FROM Unique where name = 'User.auth_id:own:someusername@example.com'

或者

SELECT * FROM Unique where 'name=User.auth_id:own:' = 'someusername@example.com'

这些查询要么在语法上无效,要么具有无效参数。我显然已经查看了 Google 的官方文档,但找不到编写此文档的方法。


编辑: 有一种方法可以使用 Unique 方法检索 python 中的所有唯一记录。我正在寻找的是一个 GQL 查询。


4

0 回答 0