的終點原數據存儲API是不是一個正式的是App Engine SDK的一部分,但是我一直在研究一個庫。
這是documented,我很高興來這裏回答你的問題。事實證明,EndpointsModel
是subclass of ndb.Model
,所以你得到兩全其美:
>>> from endpoints_proto_datastore.ndb import EndpointsModel
>>> from google.appengine.ext import ndb
>>> EndpointsModel.__bases__ == (ndb.Model,)
True
由於文檔着陸頁上提到的,優點是庫:
.. 。允許現有模型類與Google Cloud 端點一起使用。通過擴展ndb.Model
類 和endpoints
庫提供的功能,該庫允許您直接在您的API方法中與模型實體進行交互,而不是通過ProtoRPC 請求進行交互。
我們還給出了使用該庫的talk。其中,我們明確提到您需要將endpoints_proto_datastore
library添加到您的應用程序中。
$ cd path/to/your/application/code
$ wget https://endpoints-proto-datastore.googlecode.com/files/endpoints_proto_datastore.zip
$ unqip -q endpoints_proto_datastore.zip