space_object:get() | Tarantool
Submodule space_object:get()


object space_object

Search for a tuple in the given space.

  • space_object (space_object) – an object reference
  • key (scalar/table) – value to be matched against the index key, which may be multi-part.

the tuple whose index key matches key, or nil.



Possible errors:

  • space_object does not exist.
  • ER_TRANSACTION_CONFLICT if a transaction conflict is detected in the MVCC transaction mode.

Complexity factors: Index size, Index type, Number of indexes accessed, WAL settings.

The function returns a set of tuples as a Lua table; the function returns at most a single tuple. And it is possible to get the first tuple in a space by appending [1]. Therefore{1} has the same effect as{1}[1], if exactly one tuple is found.


Using field names instead of field numbers: get() can use field names described by the optional space_object:format() clause. This is true because the object returned by get() can be used with most of the features described in the Submodule box.tuple description, including tuple_object[field-name].

For example, we can format the tester space with a field named x and use the name x in the index definition:{{name='x',type='scalar'}})'I',{parts={'x'}})

Then, if get or select retrieves a single tuple, we can reference the field ‘x’ in the tuple by its name:{1}['x']{1}[1]['x']
Found what you were looking for?