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.
- Drop Python 3.6 support (PR #327).
- The ability to connect to the Tarantool using an existing socket fd (#304).
- Exception rethrow in crud API (PR #310).
- Work with timestamps larger than year 2038 for some platforms (like Windows) (PR #311).
It covers
- building new
tarantool.Datetimeobjects from timestamp, - parsing datetime objects received from Tarantool.
- building new
- Validate
tarantool.Intervallimits with the same rules as in Tarantool (PR #302).
tarantool.Intervalarithmetic with weeks (PR #302).tarantool.Intervalweeks display instr()andrepr()(PR #302).
- Allow to require specific server protocol version and features (#267).
- Drop
msgpack-pythonsupport. Usemsgpackinstead.
- Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
- Breaking: Allow only named
on_pushandon_push_ctxforinsertandreplace. - Migrate to built-in
Warninginstead of a custom one. - Migrate to built-in
RecursionErrorinstead of a custom one. - Collect full exception traceback.
- Rework
tarantool.Datetimeimplementation to use built-indatetime.datetime. External changes are as follows. Some of them are breaking.- Package no longer depends on
pandas(#290). __repr__has been changed.- Input arguments are validated with
datetime.datetimerules. - Class is no longer expected to throw
pandas.Timestampexceptions.datetime.datetimeexceptions will be thrown instead of them. - Drop the support of
__eq__operator forpandas.Timestamp.
- Package no longer depends on
- Breaking: Remove
joinandsubscribeconnection methods.
- Discovery iproto features only for Tarantools since version 2.10.0 (#283).
- Schema fetch for spaces with foreign keys (#282).
- Support
fetch_schemaparameter for a connection (#219).
- Error code on socket error (#279).
- Support custom packer and unpacker factories (#191).
- Support crud module native API (#205).
- Support
ssl_passwordandssl_password_fileoptions to decrypt private SSL key file (#224). - Support specifying authentication method with
auth_typeand Tarantool EEpap-sha256authentication method (#269).
-
Decimal type support (#203).
-
UUID type support (#202).
-
Datetime type support and tarantool.Datetime type (#204).
Tarantool datetime objects are decoded to
tarantool.Datetimetype.tarantool.Datetimemay be encoded to Tarantool datetime objects.You can create
tarantool.Datetimeobjects either from MessagePack 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.Datetimeexposesyear,month,day,hour,minute,sec,nsec,timestampandvalue(integer epoch time with nanoseconds precision) properties if you need to converttarantool.Datetimeto 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
tzoffsetparameter 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
tzoffsetproperty to get timezone offset of a datetime object. -
Timezone in datetime type support (#204).
Use
tzparameter 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
tzandtzoffsetis specified,tzis used.You may use
tzproperty to get timezone name of a datetime object. -
Datetime interval type support and tarantool.Interval type (#229).
Tarantool datetime interval objects are decoded to
tarantool.Intervaltype.tarantool.Intervalmay be encoded to Tarantool interval objects.You can create
tarantool.Intervalobjects either from MessagePack data or by using the same API as in Tarantool:di = tarantool.Interval(year=-1, month=2, day=3, hour=4, minute=-5, sec=6, nsec=308543321, adjust=tarantool.IntervalAdjust.NONE)
Its attributes (same as in init API) are exposed, so you can use them if needed.
-
Datetime interval arithmetic support (#229).
Valid operations:
tarantool.Datetime+tarantool.Interval=tarantool.Datetimetarantool.Datetime-tarantool.Interval=tarantool.Datetimetarantool.Datetime-tarantool.Datetime=tarantool.Intervaltarantool.Interval+tarantool.Interval=tarantool.Intervaltarantool.Interval-tarantool.Interval=tarantool.Interval
Since
tarantool.Intervalcould containmonthandyearfields and such operations could be ambiguous, you can useadjustfield to tune the logic. The behavior is the same as in Tarantool, see Interval arithmetic RFC.-
tarantool.IntervalAdjust.NONE-- only truncation toward the end of month performed (default mode).>>> dt = tarantool.Datetime(year=2022, month=3, day=31) datetime: Timestamp('2022-03-31 00:00:00'), tz: "" >>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.NONE) >>> dt + di datetime: Timestamp('2022-04-30 00:00:00'), tz: ""
-
tarantool.IntervalAdjust.EXCESS-- overflow mode, without any snap or truncation to the end of month, straight addition of days in month, stopping over month boundaries if there is less number of days.>>> dt = tarantool.Datetime(year=2022, month=1, day=31) datetime: Timestamp('2022-01-31 00:00:00'), tz: "" >>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.EXCESS) >>> dt + di datetime: Timestamp('2022-03-02 00:00:00'), tz: ""
-
tarantool.IntervalAdjust.LAST-- mode when day snaps to the end of month, if happens.>>> dt = tarantool.Datetime(year=2022, month=2, day=28) datetime: Timestamp('2022-02-28 00:00:00'), tz: "" >>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.LAST) >>> dt + di datetime: Timestamp('2022-03-31 00:00:00'), tz: ""
-
Support iproto feature discovery (#206).
-
Backport ConnectionPool support for Python 3.6.
-
Support extra information for iproto errors (#232).
-
Error extension type support (#232).
-
Support pandas way to build datetime from timestamp (PR #252).
timestamp_since_utc_epochis a parameter to set timestamp conversion behavior for timezone-aware datetimes.If
False(default), behaves similar to Tarantooldatetime.new():>>> dt = tarantool.Datetime(timestamp=1640995200, timestamp_since_utc_epoch=False) >>> dt datetime: Timestamp('2022-01-01 00:00:00'), tz: "" >>> dt.timestamp 1640995200.0 >>> dt = tarantool.Datetime(timestamp=1640995200, tz='Europe/Moscow', ... timestamp_since_utc_epoch=False) >>> dt datetime: Timestamp('2022-01-01 00:00:00+0300', tz='Europe/Moscow'), tz: "Europe/Moscow" >>> dt.timestamp 1640984400.0
Thus, if
False, datetime is computed from timestamp since epoch and then timezone is applied without any conversion. In that case,dt.timestampwon't be equal to initializationtimestampfor all timezones with non-zero offset.If
True, behaves similar topandas.Timestamp:>>> dt = tarantool.Datetime(timestamp=1640995200, timestamp_since_utc_epoch=True) >>> dt datetime: Timestamp('2022-01-01 00:00:00'), tz: "" >>> dt.timestamp 1640995200.0 >>> dt = tarantool.Datetime(timestamp=1640995200, tz='Europe/Moscow', ... timestamp_since_utc_epoch=True) >>> dt datetime: Timestamp('2022-01-01 03:00:00+0300', tz='Europe/Moscow'), tz: "Europe/Moscow" >>> dt.timestamp 1640995200.0
Thus, if
True, datetime is computed in a way thatdt.timestampwill always be equal to initializationtimestamp. -
Support iproto feature push (#201).
-
Pack pip package with GitHub Actions (#198).
-
Publish pip package with GitHub Actions (#198).
-
Pack RPM package with GitHub Actions (#164, #198).
-
Publish RPM package with GitHub Actions (#164, #198).
-
Pack deb package with GitHub Actions (#198).
-
Publish deb package with GitHub Actions (#198).
- 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.
- Change documentation HTML theme (#67).
- Update API documentation strings (#67).
- Update documentation index, quick start and guide pages (#67).
- Use git version to set package version (#238).
- Extract tarantool.Datetime encode and decode to external functions (PR #252).
- Extract tarantool.Interval encode and decode to external functions (PR #252).
- Do not enforce msgpack version (#198).
- Package build (#238).
- Allow any MessagePack supported type as a request key (#240).
- Putting test files in pip package (#238).
- Make connection close idempotent (#250).
- readthedocs version (#255).
- timezone offset with old pytz and pandas (#198).
- 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.infoon 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.ANYchooses any instance.Mode.RWchooses an RW instance.Mode.ROchooses an RO instance.Mode.PREFER_RWchooses an RW instance, if possible, an RO instance otherwise.Mode.PREFER_ROchooses 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 usesANYby 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/decodebinary 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=NonePython 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
bytesas 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
bytesas key.Thus, an
encoding="utf-8"connection may be used to work with UTF-8 strings andvarbinary, and anencoding=Noneconnection 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=Falseconnection option (#166, PR #161). - Support the Database API (PEP-0249) (PR #161).
- Various improvements in README (PR #147, PR #151, PR #180).
- Support
encoding=Noneconnections (PR #172). - Various improvements and fixes in tests (8ff9a3f, bd37703, PR #165, #178, PR #179, PR #181).