tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Unable to select ALL records from a space without specifying iterator. #86

Closed amdei closed 7 years ago

amdei commented 7 years ago

In order to select all records from space I do:

tnt = tarantool.connect("localhost", 3322)
sp = tnt.space('lalala') # lalala - space name
n_list = sp.select(index=0, iterator=ITERATOR_ALL)

and it works.

At the same time, none of the following two lines works:

n_list = sp.select()
n_list = sp.select(index=0)

results in:

tarantool.error.DatabaseError: (19, 'Invalid key part count in an exact match (expected 1, got 0)')

According to dev team last two cases is a bug.

bigbes commented 7 years ago

Everything should works fine on latest 0.5.5 tarantool config:

[± |master ↑2 ?:1 ✗|] → cat 1.lua
box.cfg{
    listen = 3310,
}

local sp = box.schema.create_space('help', {})
sp:create_index('pr', {
    type = 'hash'
})
sp:insert{1, 2, 4}
sp:insert{2, 3, 4}

box.schema.user.grant('guest', 'read,write', 'space', 'help')

python+output

In [27]: a = tarantool.connect('localhost', 3310)

In [28]: b = a.space(512)

In [29]: b.select()
Out[29]:
- [1, 2, 4]
- [2, 3, 4]

In [30]: b.select(index=0)
Out[30]:
- [1, 2, 4]
- [2, 3, 4]
bigbes commented 7 years ago

Feel free to reopen this ticket in case you still have problems with this select