Python 3.x google.cloud.exceptions.NotFound:404项目不存在或不包含活动云数据存储数据库
我正在尝试使用Python 3.x google.cloud.exceptions.NotFound:404项目不存在或不包含活动云数据存储数据库,python-3.x,google-app-engine,google-cloud-datastore,Python 3.x,Google App Engine,Google Cloud Datastore,我正在尝试使用googleclouddatastoreemulator测试一些数据存储代码 class GoogleDBHandler: def __init__(self, datastore_client, kind): self.client = datastore_client self.kind = kind def get_tables(self): # [START kind_run_query]
googleclouddatastoreemulator
测试一些数据存储代码
class GoogleDBHandler:
def __init__(self, datastore_client, kind):
self.client = datastore_client
self.kind = kind
def get_tables(self):
# [START kind_run_query]
query = self.client.query(kind='__kind__')
query.keys_only()
kinds = [entity.key.name for entity in query.fetch()]
# [END kind_run_query]
return kinds
# starting testing google cloud datastore
gc_datastore_client = datastore.Client()
gc_datastore_handler = GoogleDBHandler(gc_datastore_client, kind='vendor')
tab = gc_datastore_handler.get_tables()[0]
我犯了以下错误
google.cloud.exceptions.NotFound: 404 The project project_name does not exist or it does not contain an active Cloud Datastore database.
在测试之前,我已经运行了以下命令
gcloud beta auth application-default login
gcloud beta emulators datastore start
我想知道这里有什么问题
有趣的是,当我第一次运行数据模拟器并测试一些代码时,它没有任何问题
更新
问题已经解决,因为
应用程序引擎
已关闭,并且在使用数据存储模拟器
时,即使您正在运行应用程序默认登录命令,也必须始终打开该引擎。请尝试将项目ID传递到数据存储。客户端(“project-ID”)方法并再次检查。@BravinBalasubramaniam这与我传递默认的项目id
@daiyue相同。您应该添加答案和解决方案(并接受它),而不是编辑问题中的答案-请在答案中描述应用程序引擎是如何/在哪里关闭的-IMHO这是上下文中有用的信息。