2016-06-02 8 views
9

से पहुंच डेटास्टोर इकाइयां GAE NDB डेटास्टोर के नए प्रलेखन पढ़ना: https://cloud.google.com/appengine/docs/python/ndb/modelclass#class_methodsGAE NDB डेटास्टोर नई सुविधा: अन्य GAE एप्लिकेशन

get_by_id(id, parent=None, app=None, namespace=None, **ctx_options) 

Returns an entity by ID. This is really just a shorthand for Key(cls, id).get() .

Arguments

id A string or integer key ID. parent Parent key of the model to get.

app (keyword arg) ID of app. If not specified, gets data for current app.

namespace (keyword arg) Namespace. If not specified, gets data for default namespace.

**ctx_options Context options Returns a model instance or None if not found.

मैं इस नए app पैरामीटर पता चलता है। बहुत समय पहले मुझे यही चाहिए !!!!! मैं बस app "xxxxxglobal" से एप्लिकेशन का "xxxxxdev" डेटासंग्रह पहुँचने का प्रयास किया, लेकिन मैं इस त्रुटि मिलती है:

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 

मैं खातों सेवाएं जोड़ी [email protected] और [email protected] इस लिंक में एक-दूसरे के व्यवस्थापक के रूप में: https://console.cloud.google.com/iam-admin/iam/

लेकिन मुझे अभी भी समस्या मिलती है।

क्या कोई मेरी मदद कर सकता है? मुझे यह जानने की जरूरत है कि नियंत्रण कक्ष में मैं ऐप इंजन में अन्य ऐप के डेटास्टोर पहुंच प्रदान कर सकता हूं।

+0

मैं इस का जवाब देखने के लिए अच्छा लगेगा। Google सेवा खाता सामग्री बहुत भ्रमित है और मुझे कोई अच्छा दस्तावेज़ नहीं मिला है। –

+0

संभवतः इस आगामी सुविधा से संबंधित है: https://code.google.com/p/googleappengine/issues/detail?id=1300। –

+0

कुछ जवाब * पहले से ही काम कर रहे हैं, जैसा कि इस उत्तर में सुझाया गया है: http://stackoverflow.com/a/25747058/4495081 –

उत्तर

1

वर्तमान में, एनडीबी क्लाउड डेटास्टोर एपीआई का उपयोग नहीं करता है और ऑपरेशन के सामान्य तरीके में किसी अन्य ऐप के डेटास्टोर से कनेक्ट नहीं हो सकता है - यह कोड को चालू होने वाले ऐप के डेटास्टोर से मूल रूप से जोड़ता है।

हालांकि, आप विकास वातावरण से विभिन्न ऐप्स के डेटास्टोर से कनेक्ट होने के लिए remote api का उपयोग कर सकते हैं।

वर्तमान में एक ही ऐप से एकाधिक डेटास्टोर तक पहुंचने की संभावना के लिए Public Issue Tracker for App Engine में एक खुला फ़ीचर अनुरोध है। विशेष रूप से NDB के लिए एक सुविधा का अनुरोध पोस्ट करने के लिए स्वतंत्र महसूस, हालांकि the following comments in the source से यह प्रतीत होता है यह पहले से ही कुछ ऐसा है जो काम किया-ऑन किया जा रहा है है:

current_app_id = os.environ.get('APPLICATION_ID', None) 
    if current_app_id and current_app_id != app_id: 
    # TODO(pcostello): We should support this so users can connect to different 
    # applications. 
    raise ValueError('Cannot create a Cloud Datastore context that connects ' 
        'to an application (%s) that differs from the application ' 
        'already connected to (%s).' % (app_id, current_app_id)) 
    os.environ['APPLICATION_ID'] = app_id