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

Python DBAPI driver throws exception when fetching EXPLAIN results #3380

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

Python DBAPI driver throws exception when fetching EXPLAIN results #3380

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2013-10-03 10:25:33 +0200
From: Pete Hollobon <>
To: clients devs <>
Version: 11.15.15 (Feb2013-SP4)
CC: pete

Last updated: 2013-10-22 14:42:10 +0200

Comment 19234

Date: 2013-10-03 10:25:33 +0200
From: Pete Hollobon <>

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36
Build Identifier:

The Python DBAPI driver throws an exception when fetching EXPLAIN query results:

Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import monetdb.sql
db = monetdb.sql.connect(database="demo")
cursor = db.cursor()
cursor.execute("explain select count(*) from sys.tables")
31
cursor.fetchone()
Traceback (most recent call last):
File "", line 1, in
File "monetdb/sql/cursors.py", line 205, in fetchone
result = self.__rows[self.rownumber - self.__offset]
IndexError: list index out of range

I've attached patches that fix this issue for both Python 2 and 3 versions of the driver, so it works as expected:

import monetdb.sql
db = monetdb.sql.connect(database="demo")
cursor = db.cursor()
cursor.execute("explain select count(*) from sys.tables")
31
cursor.fetchone()
('function user.s0_14():void;',)
cursor.fetchone()
(' X_2:bat[:oid,:wrd] := bat.new(nil:oid,nil:wrd);',)

Thanks,
Pete.

Reproducible: Always

Comment 19235

Date: 2013-10-03 10:26:17 +0200
From: Pete Hollobon <>

Created attachment 239
Python 2 fix

Attached file: file_3380.txt (text/plain, 1186 bytes)
Description: Python 2 fix

Comment 19236

Date: 2013-10-03 10:29:59 +0200
From: Pete Hollobon <>

Created attachment 240
Python 3 fix

Attached file: file_3380.txt (text/plain, 1106 bytes)
Description: Python 3 fix

Comment 19237

Date: 2013-10-03 10:53:08 +0200
From: MonetDB Mercurial Repository <>

Changeset 119925c03cba made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=119925c03cba

Changeset description:

Added test for bug #3380.

Comment 19238

Date: 2013-10-03 10:53:10 +0200
From: MonetDB Mercurial Repository <>

Changeset c4693598a20e made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=c4693598a20e

Changeset description:

Fixed bug #3380.
Thanks to Pete Hollobon for finding and fixing the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant