tarantool / tarantool-python

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

Add count() or len() method for space #112

Closed kbelyavs closed 2 years ago

kbelyavs commented 5 years ago

It would be great to align space interface with TNT submodule box.space
For example, to get number of values, I have to use something like this:
len(space.select()) which I believe is not efficient

Totktonada commented 5 years ago

You can use <connection object>.call('box.space.<space name>:len') or <connection object>.eval('return box.space.<space name>:len()') if the relevant access is granted.

Anyway, while there is no such request in tarantool's binary protocol, we can't do anythyng more elegant in the connector.

Totktonada commented 2 years ago

(Updated my answer above.)