hannes / MonetDBLite

MonetDB reconfigured as a library
108 stars 11 forks source link

cursor is missing .description field #195

Open gijzelaerr opened 7 years ago

gijzelaerr commented 7 years ago

https://www.python.org/dev/peps/pep-0249/#description

import monetdblite
conn_lite = monetdblite.connect('/tmp/test')
cur_lite = conn_lite.cursor()
print(cur_lite.execute('SELECT * from tables'))
print(cur_lite.description)
44
None
import pymonetdb
conn = pymonetdb.connect('test')
cur = conn.cursor()
print(cur.execute('SELECT * from sys.tables'))
print(cur.description)
51
[('id', 'int', None, 32, None, None, None), ('name', 'varchar', None, 1024, None, None, None), ('schema_id', 'int', None, 32, None, None, None), ('query', 'varchar', None, 2048, None, None, None), ('type', 'smallint', None, 16, None, None, None), ('system', 'boolean', None, 1, None, None, None), ('commit_action', 'smallint', None, 16, None, None, None), ('access', 'smallint', None, 16, None, None, None), ('temporary', 'tinyint', None, 8, None, None, None)]
gijzelaerr commented 7 years ago

https://github.com/hannesmuehleisen/MonetDBLite-Python/pull/1

gijzelaerr commented 7 years ago

there are some missing things here, but at least there is a description field.

We could maybe extract a bit more information from the numpy types. Also the types need to be comparable to the dbapi types, which don't seem to be defined in the API also:

https://www.python.org/dev/peps/pep-0249/#type-objects