2013-04-09 64 views

回答

4

當您正在使用NDB你應該使用_properties獲得性能

The db, ndb, users, urlfetch, and memcache modules are imported. 
dev~cash-drawer> class X(ndb.Expando): 
... pass 
... 
dev~cash-drawer> 
dev~cash-drawer> 
dev~cash-drawer> y = X() 
dev~cash-drawer> y.a = ndb.GenericProperty() 
dev~cash-drawer> y.a = 100 
dev~cash-drawer> y.a 
100 
dev~cash-drawer> repr(y.a) 
'100' 
dev~cash-drawer> type(y.a) 
<type 'int'> 
dev~cash-drawer> y._properties 
{'a': GenericProperty('a')} 
dev~cash-drawer> 

見文檔https://developers.google.com/appengine/docs/python/ndb/entities#expando

+0

我已經加入到NDB作弊表的列表:https://docs.google .com/document/d/1AefylbadN456_Z7BZOpZEXDq8cR8LYu7QgI7bt5V0Iw/edit?pli = 1 – 2013-04-09 17:43:11

+0

啊。所以我必須自己過濾出動態屬性呢? – Joren 2013-04-09 21:03:53