在django appengine上运行Raw查询会导致游标未实现

时间:2013-06-27 08:49:16

标签: django google-app-engine djangoappengine

感谢您抽出宝贵时间来查看我的问题! 我试图在googleappgine上运行django中的以下原始查询:

models.MyModel.objects.raw(
    'select count(1) from myapp_mymodel where %s >= my_column',
    [4])

我一直收到错误:

NotImplementedError:不支持游标。

然而,游标似乎确实在djangoappengine中实现。

还有其他人遇到过这个问题吗?

回溯:

File "..../django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "..../promotions/views.py", line 562, in task_alert_stats
auto_join_sql, auto_join_params)[0]

  File "..../django/db/models/query.py", line 1381, in __getitem__
return list(self)[k]

  File "..../django/db/models/query.py", line 1326, in __iter__
query = iter(self.query)

  File "..../django/db/models/sql/query.py", line 67, in __iter__
self._execute_query()

  File "..../django/db/models/sql/query.py", line 81, in _execute_query
self.cursor.execute(self.sql, self.params)

  File "..../django/db/backends/util.py", line 34, in execute
return self.cursor.execute(sql, params)

  File "..../djangotoolbox/db/base.py", line 620, in __getattribute__
raise NotImplementedError("Cursors are not supported.")

1 个答案:

答案 0 :(得分:0)

对于遇到此问题的任何人:

我最终做了一个简单的过滤器,然后浏览结果以进一步过滤它们。