2

所以我偶然發現了EndpointsModel作爲創建模型的手段。當我看上網時,基本上沒有關於它的教程。對於使用過它的人來說,有什麼優勢?我的意思是,而不是ndb.ModelEndpointsModel vs ndb.Model

編輯:

而且,我試圖在What is the best way to auth, identify and store delicate information about users?模仿代碼只是檢查出來,但我的日食紅色線是:

from endpoints_proto_datastore.ndb import EndpointsModel 

回答

5

的終點原數據存儲API是不是一個正式的是App Engine SDK的一部分,但是我一直在研究一個庫。

這是documented,我很高興來這裏回答你的問題。事實證明,EndpointsModelsubclass 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 
相關問題