如何从我的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/
David的解决方案要求您使用App Engine实例时间发出请求,但您可以绕过它并直接向Datastore发出请求来自Compute Engine实例。有关如何执行此操作的相当不错的教程。但它不像ndb那么漂亮。
>>>以数据存储的形式导入googledatastore
>>> datastore.set_options(dataset ='project-id')
>>> req = datastore.BeginTransactionRequest()
>>> datastore.begin_transaction(req)
< datastore.datastore_v1_pb2.BeginTransactionResponse对象at ...>
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屋!