2012-07-01 36 views
0

我有以下代碼:如何在GAE上使用投影?

employees = Employee.all() 
employees.projection('first_name') 
employees.filter('passport_id =', passport_id) 
employees.order('-added') 
results = employees.fetch(5) 

第二行是不允許的:

AttributeError: 'Query' object has no attribute 'projection' 

另一種方法也將返回錯誤:

employees = db.Query(Employee, projection=('first_name')) 
TypeError: __init__() got an unexpected keyword argument 'projection' 

但如果我正確讀取the doc,它應該得到支持。

回答

1

你正在運行哪個版本的AppEngine SDK?投影查詢已添加到version 1.6.5

+0

謝謝。我使用1.5.4,所以這是原因。 –