如何在python中从Google App Engine查询

时间:2017-05-25 17:30:36

标签: python google-app-engine google-cloud-datastore google-cloud-storage

我需要在python的项目P中查询一个K类,其中的类型可以在https://ah-builtin-python-bundle-dot-P.appspot.com/上看到

from google.cloud import datastore

client = datastore.client.Client(project='P')
query = client.query(kind='K')
print list(query.fetch(1))

运行它不会返回任何内容,它只会卡在最后一行

1 个答案:

答案 0 :(得分:1)

您应该使用

创建客户端
client = datastore.Client(project = "myProjectName")

而不是

client = datastore.client.Client(project = "myProjectName")