如何从我的 Compute Engine 虚拟机访问我的 AppEngine DataStore 实体? [英] How do I access my AppEngine DataStore entities from my Compute Engine VM?
问题描述
我的应用在 App Engine 上运行,但我想从我的 Compute Engine 虚拟机访问它的 NDB DataStore 实体以进行一些处理并将结果写回 App Engine DataStore.我怎样才能做到这一点?
此外,Google Cloud DataStore 和 App Engine DataStore 是一回事吗?https://developers.google.com/datastore/https://developers.google.com/appengine/docs/python/ndb/一个>
David 的解决方案要求您使用 App Engine 实例时间来发出请求,但您可以绕过它并直接从 Compute Engine 实例向 Datastore 发出请求.关于如何执行此操作,有一个非常好的教程.但它不像ndb那么漂亮.
<预><代码>>>>导入 googledatastore 作为数据存储>>>datastore.set_options(dataset='project-id')>>>req = datastore.BeginTransactionRequest()>>>datastore.begin_transaction(req)<datastore.datastore_v1_pb2.BeginTransactionResponse 对象位于 ...>My app is running on App Engine, but I would like to access its NDB DataStore entities from my Compute Engine VM to do some processing and write the results back to the App Engine DataStore. How can I do that?
Also, are the Google Cloud DataStore and App Engine DataStore the same thing? https://developers.google.com/datastore/ https://developers.google.com/appengine/docs/python/ndb/
David's solution requires you to use App Engine instance time to make requests, but you can bypass it and make requests directly to Datastore from Compute Engine instance. There is a pretty good tutorial about how to do this. But its not so pretty like ndb.
>>> import googledatastore as datastore
>>> datastore.set_options(dataset='project-id')
>>> req = datastore.BeginTransactionRequest()
>>> datastore.begin_transaction(req)
<datastore.datastore_v1_pb2.BeginTransactionResponse object at ...>
这篇关于如何从我的 Compute Engine 虚拟机访问我的 AppEngine DataStore 实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!