GitHub / tarantool / tarantool-python
Python client library for Tarantool
JSON API: http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Ftarantool-python
PURL: pkg:github/tarantool/tarantool-python
Stars: 105
Forks: 46
Open issues: 21
License: bsd-2-clause
Language: Python
Size: 1.06 MB
Dependencies parsed at: Pending
Created at: about 14 years ago
Updated at: 4 months ago
Pushed at: 8 months ago
Last synced at: about 2 months ago
Commit Stats
Commits: 441
Authors: 43
Mean commits per author: 10.26
Development Distribution Score: 0.717
More commit stats: https://commits.ecosyste.ms/hosts/GitHub/repositories/tarantool/tarantool-python
Topics: connector, python, python3, synchronous, tarantool
1.2.0: socket fd
1.2.0
Overview
This release introduces socket fd connect support.
Added
- The ability to connect to the Tarantool using an existing socket fd (#304).
Download
tarantool-python 1.1.2
1.1.2
Overview
This release introduces several bugfixes and behavior improvements.
Fixed
- 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
Download
tarantool-python 1.1.1
1.1.1
Overview
This release introduces various datetime interval fixes and quality of life improvements.
Breaking changes
- Forbid to create datetime intervals out of Tarantool limits (PR #302).
Changed
- Validate
tarantool.Intervallimits with the same rules as in Tarantool (PR #302).
Fixed
tarantool.Intervalarithmetic with weeks (PR #302).tarantool.Intervalweeks display instr()andrepr()(PR #302).
Download
tarantool-python 1.1.0
1.1.0
Overview
This release introduces API to request server protocol version and feature, as well as introduce decimal bugfix.
Breaking changes
- Drop
msgpack-pythonsupport. (Package not supported since 2019.) Usemsgpackinstead.
Added
- Allow to require specific server protocol version and features (#267).
Fixed
- Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
Download
tarantool-python 1.0.0
1.0.0
Overview
This release introduces several minor behavior changes to make API more consistent.
Starting from this release, connector no longer depends on pandas.
Breaking changes
- Allow only named
on_pushandon_push_ctxforinsertandreplace. tarantool.Datetime__repr__has been changed.tarantool.Datetimeinput arguments are validated withdatetime.datetimerules.tarantool.Datetimeis no longer expected to throwpandas.Timestampexceptions.datetime.datetimeexceptions will be thrown instead of them.- Drop the support of
__eq__operator oftarantool.Datetimeforpandas.Timestamp. - Remove
joinandsubscribeconnection methods.
Changes
- Migrate to built-in
Warninginstead of a custom one. - Migrate to built-in
RecursionErrorinstead of a custom one. - Collect full exception traceback.
- Package no longer depends on
pandas(#290).
Infrastructure
- Lint the code with
pylint,flake8andcodespell.
Download
tarantool-python 0.12.1
0.12.1
Overview
This release introduces several bug fixes and behavior improvements.
Breaking changes
This release should not break any existing behavior.
Bugfixes
- Discovery iproto features only for Tarantools since version 2.10.0 (#283).
- Schema fetch for spaces with foreign keys (#282).
Download
tarantool-python 0.12.0
0.12.0
Overview
This release introduces the support of fetch_schema connection option to disable schema fetch and various fixes.
Breaking changes
This release should not break any existing behavior.
New features
fetch_schemaparameter for a connection (#219).
Bugfixes
- Error code on socket error (#279).
Thanks
We want to thank @bekhzod91 for a bugfix contribution.
Download
tarantool-python 0.11.0
0.11.0
Overview
This release introduces the support of crud module API, encoding and decoding customization and various security features for Tarantool EE.
Breaking changes
This release should not break any existing behavior.
New features
- 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).
Download
tarantool-python 0.10.0
0.10.0
Overview
This release introduces the support of extension types (decimal, uuid, error, datetime, interval) in MessagePack, various IProto features support (feature discovery and push protocol) and major infrastructure updates (scm version computation, full documentation for external and internal API both as code docstrings and readthedocs HTML, deb and RPM packages, and everything is processed with CI/CD pipelines).
For deb and RPM packages, search for python3-tarantool.
Breaking changes
This release should not break any existing behavior.
New features
-
Backport ConnectionPool support for Python 3.6 (PR #245).
-
Support iproto feature discovery (#206).
-
Decimal type support (#203).
-
UUID type support (#202).
-
Support extra information for iproto errors (#232).
-
Error extension type support (#232).
-
Datetime type support and tarantool.Datetime type (#204, PR #252).
Tarantool datetime objects are decoded to
tarantool.Datetime
type.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 convert
tarantool.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))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.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.timestamp_since_utc_epochis a parameter to set timestamp
convertion 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.0Thus, if
False, datetime is computed from timestamp
since epoch and then timezone is applied without any
convertion. 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.0Thus, if
True, datetime is computed in a way thatdt.timestampwill
always be equal to initializationtimestamp. -
Datetime interval type support and tarantool.Interval type (#229).
Tarantool datetime interval objects are decoded to
tarantool.Interval
type.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: ""
-
Full documentation of internal and external API (#67).
Bugfixes
- Allow any MessagePack supported type as a request key (#240).
- Make connection close idempotent (#250).
Infrastructure
- Use git version to set package version (#238).
- Test pip install from branch (PR #241).
- Pack and publish pip, RPM and deb packages with GitHub Actions (#164, #198).
- Publish on readthedocs with CI/CD (including PRs) (#67).
Download
tarantool-python 0.9.0
0.9.0
Overview
This release features SSL support.
To use encrypted connection with Tarantool Enterprise Edition instance, pass “ssl” transport parameter on connect:
con = tarantool.Connection(
host, port,
user=user,
password=pass,
transport="ssl")
To verify the server, set client trusted certificate authorities (CA) file with ssl_ca_file parameter:
con = tarantool.Connection(
host, port,
user=user,
password=password,
transport="ssl",
ssl_ca_file=client_ca_file)
If the server authenticates clients using certificates issued by given CA, you must provide private SSL key file with ssl_key_file parameter and SSL certificate file with ssl_cert_file parameter. Otherwise, these parameters are optional.
con = tarantool.Connection(
host, port,
user=user,
password=password,
transport="ssl",
ssl_key_file=client_key_file,
ssl_cert_file=client_cert_file)
To set SSL ciphers, set them with ssl_ciphers parameter as a colon-separated (:) string:
con = tarantool.Connection(
host, port,
user=user,
password=password,
transport="ssl",
ssl_ciphers=client_ssl_ciphers)
ConnectionPool and MeshConnection also support these parameters.
mesh = tarantool.MeshConnection(
addrs={
"host": host,
"post": port,
"transport": "ssl",
"ssl_key_file": client_key_file,
"ssl_cert_file": client_cert_file,
"ssl_ca_file": client_ca_file,
"ssl_ciphers": client_ssl_ciphers,
},
user=user,
password=password)
pool = tarantool.ConnectionPool(
addrs={
"host": host,
"post": port,
"transport": "ssl",
"ssl_key_file": client_key_file,
"ssl_cert_file": client_cert_file,
"ssl_ca_file": client_ca_file,
"ssl_ciphers": client_ssl_ciphers,
},
user=user,
password=password)
See Tarantool Enterprise Edition manual for details.
Breaking changes
There are no breaking changes in the release.
New features
- SSL support (PR #220, #217).
Testing
- Tarantool Enterprise testing workflow on GitHub actions (PR #220).
Download