我正在尝试访问ODK推送到数据存储中的数据。当我查询一个我通过Python创建的名为"ProductSalesData“的实体时,下面的代码行得通。ODK给出的数据实体名称是"opendatakit.test1“。当我将数据模型更新为class opendatakit.test1(db.Model)时,它显然是由于sytax错误而崩溃。我该如何调用这些数据呢?
#!/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)发布于 2014-04-02 04:08:08
我知道您标记了GAE,但您必须通过数据存储直接访问它吗?
如果不是这样的话,我使用已经内置于聚合中的API的效果更好:https://code.google.com/p/opendatakit/wiki/BriefcaseAggregateAPI
如果你需要GAE访问,我建议ODK开发人员组在google组上-他们非常活跃。
https://stackoverflow.com/questions/21614345
复制相似问题