2014-02-06 30 views
0

我試圖訪問ODK推入數據存儲的數據。當我查詢我通過Python創建的實體(稱爲「ProductSalesData」)時,下面的代碼字很好。實體名稱ODK賦予它的數據是「opendatakit.test1」。當我將數據模型更新爲class opendatakit.test1(db.Model)時,顯然由於sytax錯誤而導致炸彈爆炸。我如何調用這些數據?來自ODK的數據存儲實體訪問

#!/usr/bin/env python 

import webapp2 

from google.appengine.ext import db 


class ProductSalesData(db.Model): 
    product_id = db.IntegerProperty() 
    date = db.DateTimeProperty() 
    store = db.StringProperty() 

q = ProductSalesData.all() 


class simplequery(webapp2.RequestHandler): 
    def get(self): 
    for ProductSalesData in q: 
     self.response.out.write('Result:%s<br />' % ProductSalesData.store) 


app = webapp2.WSGIApplication(
            [('/', simplequery)], 
            debug=True) 

回答