Developer’s guide

Tarantool database basic concepts

To understand, what is “space”, “tuple” and what basic operations are, refer to Tarantool data model documentation.

Field types

Tarantool uses MessagePack as a format for receiving requests and sending responses. Refer to Lua versus MessagePack to see how types are encoded and decoded.

While working with Tarantool from Python with this connector, each request data is encoded to MessagePack and each response data is decoded from MessagePack with the Python MessagePack module. See its documentation to explore how basic types are encoded and decoded.

There are several cases when you may tune up the behavior. Use tarantool.Connection parameters to set Python MessagePack module options.

Use encoding to tune behavior for string encoding.

encoding='utf-8' (default):

Python

->

MessagePack (Tarantool/Lua)

->

Python

str

->

mp_str (string)

->

str

bytes

->

mp_bin (binary/cdata)

->

bytes

encoding=None (work with non-UTF8 strings):

Python

->

MessagePack (Tarantool/Lua)

->

Python

bytes

->

mp_str (string)

->

bytes

str

->

mp_str (string)

->

bytes

->

mp_bin (binary/cdata)

->

bytes

Use use_list to tune behavior for mp_array (Lua table) decoding.

use_list='True' (default):

Python

->

MessagePack (Tarantool/Lua)

->

Python

list

->

mp_array (table)

->

list

tuple

->

mp_array (table)

->

list

use_list='False':

Python

->

MessagePack (Tarantool/Lua)

->

Python

list

->

mp_array (table)

->

tuple

tuple

->

mp_array (table)

->

tuple

Tarantool implements several extension types. In Python, they are represented with in-built and custom types:

Request response

Server requests (except for ping()) return Response instance in case of success.

Response is inherited from collections.abc.Sequence, so you can index response data and iterate through it as with any other serializable object.