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

Results with repeating columns are not handled correctly #35

Open
kutsurak opened this issue Mar 26, 2019 · 1 comment
Open

Results with repeating columns are not handled correctly #35

kutsurak opened this issue Mar 26, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@kutsurak
Copy link
Member

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])}
@kutsurak kutsurak added the bug label Mar 26, 2019
@kutsurak kutsurak added this to the 0.7.0 milestone Mar 26, 2019
@kutsurak kutsurak self-assigned this Mar 26, 2019
@kutsurak
Copy link
Member Author

kutsurak commented Mar 27, 2019

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

No branches or pull requests

1 participant