Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Results with repeating columns are not handled correctly #35

@kutsurak

Description

@kutsurak
import monetdblite as mdbl

c = mdbl.make_connection('/tmp/db')
cc = c.cursor()
cc.create('st', {'i': [1, 2, 3]})
cc.execute('select * from st,st')

The expected result is a table with two columns both named i.

The actual result is:

cc.fetchnumpy()

{'i': array([1, 1, 1, 2, 2, 2, 3, 3, 3])}

This seems to be an inherent limitation of how results are represented in MonetDBLite-Python, since we cannot have two different values in a dictionary with the same key. The workaround is to execute the query naming the columns explicitly:

cc.execute('select f1.i as i1, f2.i as i2 from st as f1, st as f2')
cc.fetchnumpy()

{'i1': array([1, 1, 1, 2, 2, 2, 3, 3, 3]),
 'i2': array([1, 2, 3, 1, 2, 3, 1, 2, 3])}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions