Subject | fdb 1.4.7: ProgrammingError: Cannot fetch from this cursor because it has not executed a statement. |
---|---|
Author | Maximiliano Robaina |
Post date | 2015-06-22T13:03:20Z |
Hi,
I get a strange issue running fdb 1.4.7 behind django-firebird 1.6 [1]
I'm using iterator for performance issues. Then I have got something like this:
huge_object_list = MyModel.object.filter(...).iterator()
for object in huge_object_list:
object.data = 'some data...'
object.save()
At some point, I get an exception
ProgrammingError: Cannot fetch from this cursor because it has not executed a statement.
The full traceback is:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 800, in <lambda>
result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/utils.py", line 106, in inner
return func(*args, **kwargs)
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/utils.py", line 106, in inner
return func(*args, **kwargs)
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/fdb/fbcore.py", line 3461, in fetchmany
row = self.fetchone()
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/fdb/fbcore.py", line 3439, in fetchone
raise ProgrammingError("Cannot fetch from this cursor because"
ProgrammingError: Cannot fetch from this cursor because it has not executed a statement.
For some reason, in Cursor.fetchone() self._ps lost the statement to execute the next sentence.
Any help will be appreciated
I'm running all over Ubuntu 12.04 desktop, python 2.7, firebird2.5-super, fdb 1.4.7
Also, this error occur in production server: Ubuntu 14.04 64 bits, firebird2.5-superclassic
[1] https://github.com/maxirobaina/django-firebird/tree/stable/1.6
--
Maxi
I get a strange issue running fdb 1.4.7 behind django-firebird 1.6 [1]
I'm using iterator for performance issues. Then I have got something like this:
huge_object_list = MyModel.object.filter(...).iterator()
for object in huge_object_list:
object.data = 'some data...'
object.save()
At some point, I get an exception
ProgrammingError: Cannot fetch from this cursor because it has not executed a statement.
The full traceback is:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 800, in <lambda>
result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/utils.py", line 106, in inner
return func(*args, **kwargs)
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/django/db/utils.py", line 106, in inner
return func(*args, **kwargs)
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/fdb/fbcore.py", line 3461, in fetchmany
row = self.fetchone()
File "/home/maxi/.virtualenvs/sispser2/local/lib/python2.7/site-packages/fdb/fbcore.py", line 3439, in fetchone
raise ProgrammingError("Cannot fetch from this cursor because"
ProgrammingError: Cannot fetch from this cursor because it has not executed a statement.
For some reason, in Cursor.fetchone() self._ps lost the statement to execute the next sentence.
Any help will be appreciated
I'm running all over Ubuntu 12.04 desktop, python 2.7, firebird2.5-super, fdb 1.4.7
Also, this error occur in production server: Ubuntu 14.04 64 bits, firebird2.5-superclassic
[1] https://github.com/maxirobaina/django-firebird/tree/stable/1.6
--
Maxi