Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cursor.fetchall fails #32

Closed
njnes opened this issue Jan 23, 2018 · 9 comments
Closed

cursor.fetchall fails #32

njnes opened this issue Jan 23, 2018 · 9 comments
Assignees

Comments

@njnes
Copy link
Contributor

njnes commented Jan 23, 2018

cursor.fetchall fails if the result is larger than the cursor.arraysize. The code throws an exception while I expect all result rows.

@gijzelaerr
Copy link
Collaborator

gijzelaerr commented Jan 24, 2018

I cannot replicate your issue, this works fine:

from pymonetdb import Connection
con = Connection(**settings)
cur = con.cursor()
cur.arraysize = 5
cur.execute('select * from tables, tables')
result = cur.fetchall()

Please supply python version, pymonetdb version, exception, and code example.

@njnes
Copy link
Contributor Author

njnes commented Jan 24, 2018

Traceback (most recent call last):
  File "x.py", line 12, in <module>
    print cursor.fetchone();
  File "/usr/lib/python2.7/site-packages/pymonetdb/sql/cursors.py", line 446, in fetchone
    self.nextset()
  File "/usr/lib/python2.7/site-packages/pymonetdb/sql/cursors.py", line 536, in nextset
    end = min(self.rowcoTraceback (most recent call last):
  File "x.py", line 12, in <module>
    print cursor.fetchone();
  File "/usr/lib/python2.7/site-packages/pymonetdb/sql/cursors.py", line 446, in fetchone
    self.nextset()
  File "/usr/lib/python2.7/site-packages/pymonetdb/sql/cursors.py", line 536, in nextset
    end = min(self.rowcount, self.rownumber + self.arraysize)
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
unt, self.rownumber + self.arraysize)
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

Python 2.7.14
python-pymonetdb-1.1.0-1.fc26.noarch

cursor = cursors.Cursor(connection)
#cursor.arraysize = 200
res = cursor.execute("SELECT sensor_id, description FROM sensors")
print res

for i in range(0,res):
    print cursor.fetchone();
``
(or replace the for loop with a fetchall)

@gijzelaerr
Copy link
Collaborator

I still can't replicate this problem. What MonetDB version are you using?

@ankravch
Copy link

ankravch commented Jan 24, 2018 via email

@njnes
Copy link
Contributor Author

njnes commented Jan 24, 2018

MonetDB5-server-11.27.11-20171204.fc26.x86_64

@gijzelaerr
Copy link
Collaborator

@ankravch what do you mean with incompatible types? Cursor.arraysize should never be None. If it is None then it is manually set to None (which is invalid) or it is a bug, but I don't understand where.

@ankravch
Copy link

ankravch commented Jan 24, 2018 via email

@gijzelaerr
Copy link
Collaborator

gijzelaerr commented Sep 17, 2019

hi @ankravch . Sorry for the delay in replying, I forgot about this issue.

Its true that replysize is set to None, but in the same function it is directly set to a valid value:

https://github.com/gijzelaerr/pymonetdb/blob/master/pymonetdb/sql/connections.py#L63

Effectively that means that replysize is never None outside that scope. That statement is only there to make the typing checking logic happy.

gijzelaerr added a commit that referenced this issue Sep 17, 2019
@gijzelaerr
Copy link
Collaborator

default is 0 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants