python - GAE NDB Datastore new feature: Access Datastore entities from other GAE app -
reading new documentation of gae ndb datastore: https://cloud.google.com/appengine/docs/python/ndb/modelclass#class_methods
get_by_id(id, parent=none, app=none, namespace=none, **ctx_options)
returns entity id. shorthand
key(cls, id).get()
.arguments
id
string or integer key id. parent parent key of model get.
app
(keyword arg) id of app. if not specified, gets data current app.
namespace
(keyword arg) namespace. if not specified, gets data default namespace.
**ctx_options
context options returns model instance or none if not found.
i discover new app
parameter. needed since long time ago!!!!! tried access datastore of app "xxxxxdev" app "xxxxxglobal" error:
file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1373, in check_rpc_success raise _todatastoreerror(err) badrequesterror: app s~xxxxxglobal cannot access app xxxxxxdev's data
i added accounts services xxxxxdev@appspot.gserviceaccount.com , xxxxxglobal@appspot.gserviceaccount.com admin of each other in link: https://console.cloud.google.com/iam-admin/iam/
but still receive problem.
can me? need know in control panel can grant datastore access other app in app engine.
currently, ndb doesn't use cloud datastore api , in normal mode of operation can't connect app's datastore - connects natively datastore of app code running on.
you can, however, use remote api have ndb connect datastores of different apps development environment.
there [an open feature request in public issue tracker app engine possibility of accessing multiple datastores single app. feel free post feature request ndb specifically, although the following comments in source appears that's being worked-on:
current_app_id = os.environ.get('application_id', none) if current_app_id , current_app_id != app_id: # todo(pcostello): should support users can connect different # applications. raise valueerror('cannot create cloud datastore context connects ' 'to application (%s) differs application ' 'already connected (%s).' % (app_id, current_app_id)) os.environ['application_id'] = app_id