简体   繁体   English

Google Cloud Datastore-在开发者控制台中按键过滤的正确语法是什么?

[英]Google Cloud Datastore - What is the correct syntax to filter by Key in the Developer Console?

I'm trying to query for an entity User in a Google cloud datastore with a key, using Googles developers console query filter. 我正在尝试使用Google开发人员控制台查询过滤器在带有密钥的Google云数据存储区中查询实体用户。 (Google Cloud Developer Console -> Cloud Datastore -> Query) (Google Cloud开发者控制台-> Cloud Datastore->查询)

在此处输入图片说明

I fail to decipher the example syntax and am always prompted with the following error message: 我无法解释示例语法,并且总是提示以下错误消息:

Error: Keys for datastore operations must be in the format Key('kind0', 'name0'/id0, 'kind1', 'name1'/id1, ...)

On appengine.google.com I used to query for a specific key on a User like this: 我曾经在appengine.google.com上查询用户的特定密钥,如下所示:

SELECT * FROM User WHERE __key__ = Key('User','XXXXX')

I tried Key('User','XXXXX') in the Google developers console but was always pointed to the error message above. 我在Google开发人员控制台中尝试了Key('User','XXXXX') ,但始终指向上面的错误消息。 Any ideas what the correct syntax would be? 任何想法正确的语法是什么?

Thanks in advance! 提前致谢!

The parser seems to be overly strict. 解析器似乎过于严格。 As a workaround, you can add a space between the arguments to Key(): 解决方法是,您可以在Key()的参数之间添加一个空格:

SELECT * FROM User WHERE __key__ = Key('User', 'XXXXX')

What's the type of the key? 钥匙的类型是什么? Using Key('User', ) should work on the console. 使用Key('User',)应该可以在控制台上使用。 I tried here and it worked for an Entity named person with a numeric id. 我在这里尝试过,它适用于具有数字ID的名为person的实体。 I used Key('Person',1). 我使用了Key('Person',1)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM