All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
Decimal type support (#203).
-
UUID type support (#202).
-
Datetime type support and tarantool.Datetime type (#204).
Tarantool datetime objects are decoded to
tarantool.Datetime
type.tarantool.Datetime
may be encoded to Tarantool datetime objects.You can create
tarantool.Datetime
objects either from msgpack data or by using the same API as in Tarantool:dt1 = tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, sec=54, nsec=308543321) dt2 = tarantool.Datetime(timestamp=1661969274) dt3 = tarantool.Datetime(timestamp=1661969274, nsec=308543321)
tarantool.Datetime
exposesyear
,month
,day
,hour
,minute
,sec
,nsec
,timestamp
andvalue
(integer epoch time with nanoseconds precision) properties if you need to converttarantool.Datetime
to any other kind of datetime object:pdt = pandas.Timestamp(year=dt.year, month=dt.month, day=dt.day, hour=dt.hour, minute=dt.minute, second=dt.sec, microsecond=(dt.nsec // 1000), nanosecond=(dt.nsec % 1000))
-
Offset in datetime type support (#204).
Use
tzoffset
parameter to set up offset timezone:dt = tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, sec=54, nsec=308543321, tzoffset=180)
You may use
tzoffset
property to get timezone offset of a datetime object. -
Timezone in datetime type support (#204).
Use
tz
parameter to set up timezone name:dt = tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, sec=54, nsec=308543321, tz='Europe/Moscow')
If both
tz
andtzoffset
is specified,tz
is used.You may use
tz
property to get timezone name of a datetime object.
- Bump msgpack requirement to 1.0.4 (PR #223). The only reason of this bump is various vulnerability fixes, msgpack>=0.4.0 and msgpack-python==0.4.0 are still supported.
- SSL support (PR #220, #217).
- Tarantool Enterprise testing workflow on GitHub actions (PR #220).
-
Reusable testing workflow for integration with tarantool artifacts (PR #192).
-
Connection pool with master discovery (PR #207, #196).
ConnectionPool is supported only for Python 3.7 or newer. Authenticated user must be able to call
box.info
on instances. For example, to give grants to'guest'
user, evaluatebox.schema.func.create('box.info') box.schema.user.grant('guest', 'execute', 'function', 'box.info')
on Tarantool instances.
ConnectionPool updates information about each server state (RO/RW) on initial connect and then asynchronously in separate threads. Application retries must be written considering the asynchronous nature of cluster state refresh. The user does not need to use any synchronization mechanisms in requests, it's all handled with ConnectionPool methods.
ConnectionPool API is the same as the plain Connection API. On each request, a connection is chosen to execute the request. A connection is chosen based on the request mode:
Mode.ANY
chooses any instance.Mode.RW
chooses an RW instance.Mode.RO
chooses an RO instance.Mode.PREFER_RW
chooses an RW instance, if possible, an RO instance otherwise.Mode.PREFER_RO
chooses an RO instance, if possible, an RW instance otherwise. All requests that guarantee to write data (insert, replace, delete, upsert, update) use the RW mode by default. The select request usesANY
by default. You can set the mode explicitly. The call, eval, execute, and ping requests require to set the mode explicitly.
Example:
pool = tarantool.ConnectionPool( addrs=[ {'host': '108.177.16.0', 'port': 3301}, {'host': '108.177.16.0', 'port': 3302}, ], user='test', password='test',) pool.call('some_write_procedure', arg, mode=tarantool.Mode.RW)
-
Breaking change: Python 2 support dropped (PR #207).
-
Breaking change:
encode
/decode
binary types for Python 3 changed to support working withvarbinary
(PR #211, #105). With Python 2, the behavior of the connector remains the same.Before this patch:
-
encoding="utf-8"
(default)Python 3 -> Tarantool -> Python 3 str -> mp_str (string) -> str bytes -> mp_str (string) -> str mp_bin (varbinary) -> bytes -
encoding=None
Python 3 -> Tarantool -> Python 3 bytes -> mp_str (string) -> bytes str -> mp_str (string) -> bytes mp_bin (varbinary) -> bytes
Several method (delete, update, select) did not support using
bytes
as key.After this patch:
-
encoding="utf-8"
(default)Python 3 -> Tarantool -> Python 3 str -> mp_str (string) -> str bytes -> mp_bin (varbinary) -> bytes -
encoding=None
Python 3 -> Tarantool -> Python 3 bytes -> mp_str (string) -> bytes str -> mp_str (string) -> bytes mp_bin (varbinary) -> bytes
All methods now support using
bytes
as key.Thus, an
encoding="utf-8"
connection may be used to work with UTF-8 strings andvarbinary
, and anencoding=None
connection may be used to work with non-UTF-8 strings. -
-
Clarify the license of the project (BSD-2-Clause) (PR #210, #197).
-
Migrate CI to GitHub Actions (PR #213, PR #216, #182).
-
Various improvements and fixes in README (PR #210, PR #215).
- json.dumps compatibility with Python 2 (PR #186).
- Unix socket support in mesh_connection (PR #189, #111).
- Various fixes in tests (PR #189, #111, PR #195, #194).
- msgpack library dependency (PR #185).
Caution: Use tarantool-python 0.7.1 instead of 0.7.0. It fixes the dependency on the msgpack library.
- Support msgpack 1.0.0 (#155, PR #173).
- SQL support (the method
<connection>.execute()
) (#159, PR #161). - Allow receiving a Tarantool tuple as a Python tuple, not a list, with
the
use_list=False
connection option (#166, PR #161). - Support the Database API (PEP-0249) (PR #161).
- Various improvements in README (PR #147, PR #151, PR #180).
- Support
encoding=None
connections (PR #172). - Various improvements and fixes in tests (8ff9a3f, bd37703, PR #165, #178, PR #179, PR #181).