Menu

#350 [Python] The iteration is not supported by python driver

open
nobody
None
5
2012-12-01
2012-12-01
Jira Trac
No

When integrating with Django, execute raw sql failed in 'python manage.py shell'. Because the CUBRIDdb python driver dosen't support the iteration.

[jinhu@NC-VM-PL-DEV-33 mysite]$ python manage.py shell
Python 2.7.3 (default, Oct 8 2012, 18:50:17)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type help, copyright, credits or license for more information.
(InteractiveConsole)
from polls.models import Poll
Poll.objects.all()
[Poll: Poll object]
a = Poll.objects.raw('select * from polls_poll')
a
RawQuerySet: 'select * from polls_poll'
for p in a:
... print p
...
Traceback (most recent call last):
File console, line 1, in module
File /home/jinhu/apps/Python-2.7.3/lib/python2.7/site-packages/django/db/models/query.py, line 1480, in __iter__
query = iter(self.query)
File /home/jinhu/apps/Python-2.7.3/lib/python2.7/site-packages/django/db/models/sql/query.py, line 76, in __iter__
return iter(result)
File /home/jinhu/apps/Python-2.7.3/lib/python2.7/site-packages/django/db/backends/util.py, line 31, in __iter__
return iter(self.cursor)
File /home/jinhu/apps/Python-2.7.3/lib/python2.7/site-packages/cubrid_django/base.py, line 59, in __iter__
return iter(self.cursor)
TypeError: 'Cursor' object is not iterable

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.