Python | Tarantool
Документация на русском языке
поддерживается сообществом


tarantool-python is the official Python connector for Tarantool. It is not supplied as part of the Tarantool repository and must be installed separately (see below for details).

Далее приводится пример полноценной программы на языке Python, которая осуществляет вставку [99999,'Value','Value'] в спейс examples с помощью высокоуровневого API для языка Python.

from tarantool import Connection

c = Connection("", 3301)
result = c.insert("examples",(99999,'Value', 'Value'))
print result

Чтобы запустить тестовую программу, сохраните ее исходный код в файл с именем и установите коннектор tarantool-python. Для установки коннектора воспользуйтесь либо командой pip install tarantool>0.4 (для установки в директорию /usr; вам потребуются права уровня root), либо командой pip install tarantool>0.4 --user (для установки в директорию ~, т.е. в используемую по умолчанию директорию текущего пользователя).

Before trying to run, check that the server instance is listening at localhost:3301 and that the space examples exists, as described earlier. To run the program, say python The program will connect to the Tarantool server, will send the INSERT request, and will not throw any exception if all went well. If the tuple already exists, the program will throw tarantool.error.DatabaseError: (3, "Duplicate key exists in unique index 'primary' in space 'examples'").

The example program only shows one request and does not show all that’s necessary for good practice. For that, please see tarantool-python project at GitHub. For an example of using Python API with queue managers for Tarantool, see queue-python project at GitHub.

Кроме того, сообщество разработчиков поддерживает другие Python-коннекторы:

The table below contains a feature comparison for asynctnt, gtarantool and tarantool-python. aiotarantool is absent there because it is quite outdated and unmaintained.

Last update: July 2022

Parameter igorcoding/asynctnt shveenkov/gtarantool tarantool/tarantool-python
License Apache License 2.0 LGPL BSD-2
Is maintained Yes No (last updated in 2016) Yes
Known Issues None None None
Documentation Yes ( No Yes ( and readthedocs (obsolete))
Testing / CI / CD GitHub Actions No (tests exist) GitHub Actions
GitHub Stars 65 17 84
Static Analysis Yes (Flake8) No No
Packaging pip pip deb, rpm, pip
Code coverage Yes No Yes
Support asynchronous mode Yes, asyncio Yes (gevent, example: No
Batching support No No No (issue #55)
Schema reload Yes (automatically, see auto_refetch_schema) Yes (automatically) Yes (automatically)
Space / index names Yes Yes Yes
Access tuple fields by names Yes No No
SQL support Yes (tests/ No Yes (tarantool/
Interactive transactions Yes No No (issue #163)
Varbinary support Yes (in MP_BIN fields) No Yes
UUID support Yes No No
Decimal support Yes No No
EXT_ERROR support Yes No No
Datetime support Yes No No
box.session.push() responses Yes (see push_subscribe option and docs/pushes.rst) No No
Session settings No No No
Graceful shutdown No No No
IPROTO_ID (feature discovering) Yes No No
Support CRUD No No No
Transparent request retrying No No No
Transparent reconnecting Autoreconnect Yes (reconnect_max_attempts, reconnect_delay) Yes (reconnect_max_attempts, reconnect_delay), checking of connection liveness
Connection pool No No Yes (with master discovery)
Support of PEP 249 – Python Database API Specification v2.0 No No Yes
Нашли ответ на свой вопрос?
Обратная связь