How to access GAE datastore with Objectify and service account credentials?

孤街醉人 提交于 2019-12-13 04:27:17

问题


Is it possible for one GAE application to access the datastore of another GAE application (both applications are hosted under the same Google account) using Objectify? If so, how can I pass service account credentials to Objectify (which API calls)?


回答1:


It is not possible. Objectify is a very simple and convenient lightweight ORM that sits on top of a GAE Datastore, thus shielding the developer from most of the complexities of using JDO/JPA.

Nowhere in the documentation have I seen the scenario you describe mentioned because that is not the problem it is trying to solve.

I suspect what you will probably need to do is create a Web Service that exposes your GAE application (whose data you want) through an API. Then have your other GAE application call those service methods to obtain the data it needs.

Alternatively, you can use something called remote_api. It allows you to access and manipulate a GAE Datastore remotely.

Below are some links I just found to similar questions after posting my answer:

Can I access Datastore entities of my other Google App Engine Applications

Can one application access other applications data querying the key in Google App Engine?




回答2:


A solution is to have only one "GAE application" but to make different Modules in your application. The Datastore will be shared between the modules.

Another solution is to use the Remote API (https://developers.google.com/appengine/docs/java/tools/remoteapi), but you won't be able to use Objectify, I think...



来源:https://stackoverflow.com/questions/23469171/how-to-access-gae-datastore-with-objectify-and-service-account-credentials

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!