|
| 1 | +tarantool-python (0.8.0-0) unstable; urgency=medium |
| 2 | + |
| 3 | + ## Overview |
| 4 | + |
| 5 | + The most interesting feature offered by this release is connection pool with |
| 6 | + automatic master discovery support. |
| 7 | + |
| 8 | + Consider a simple example. |
| 9 | + |
| 10 | + In tarantool: |
| 11 | + |
| 12 | + ```lua |
| 13 | + #!/usr/bin/env tarantool |
| 14 | + |
| 15 | + box.cfg({listen = os.getenv('LISTEN') or 3301}) |
| 16 | + box.once('init', function() |
| 17 | + -- Connection pool calls box.info() to monitor tarantool |
| 18 | + -- instances. |
| 19 | + box.schema.func.create('box.info') |
| 20 | + box.schema.user.grant('guest', 'execute', 'function', 'box.info') |
| 21 | + |
| 22 | + box.schema.space.create('s') |
| 23 | + box.space.s:create_index('pk') |
| 24 | + box.schema.user.grant('guest', 'read,write', 'space', 's') |
| 25 | + |
| 26 | + box.schema.func.create('foo') |
| 27 | + box.schema.user.grant('guest', 'execute', 'function', 'foo') |
| 28 | + end) |
| 29 | + |
| 30 | + -- Do a write request. |
| 31 | + local function foo(tuple) |
| 32 | + box.space.s:replace(tuple) |
| 33 | + end |
| 34 | + _G.foo = foo |
| 35 | + ``` |
| 36 | + |
| 37 | + In Python: |
| 38 | + |
| 39 | + ```python |
| 40 | + #!/usr/bin/env python |
| 41 | + |
| 42 | + import tarantool |
| 43 | + |
| 44 | + # Create a connection pool. |
| 45 | + pool = tarantool.ConnectionPool(addrs=[ |
| 46 | + {'host': '127.0.0.1', 'port': 3301}, |
| 47 | + {'host': '127.0.0.1', 'port': 3302}, |
| 48 | + ]) |
| 49 | + |
| 50 | + # Use the space API. |
| 51 | + pool.replace('s', [1, 2, 3]) |
| 52 | + tuple = pool.select('s', [1]) |
| 53 | + |
| 54 | + # Call a function. |
| 55 | + pool.call('foo', [[1, 2, 3]], mode=tarantool.Mode.RW) |
| 56 | + ``` |
| 57 | + |
| 58 | + This release also provides more natural mapping of msgpack string/binary types |
| 59 | + into Python string/binary types. Now `string` in tarantool is marshalled |
| 60 | + from/to `str` in Python and `varbinary` in tarantool` is marshalled from/to |
| 61 | + `bytes` in Python. See details below. |
| 62 | + |
| 63 | + ## Breaking changes |
| 64 | + |
| 65 | + This release keeps existing APIs the same, but there are important |
| 66 | + string/binary marshalling changes and Python 2 tear down. We expect that most |
| 67 | + of existing code will not require any changes, but, please, take a look on the |
| 68 | + information below. |
| 69 | + |
| 70 | + `MeshConnection` is now considered as deprecated in favor of the newly |
| 71 | + introduced `ConnectionPool`. We will remove `MeshConnection` in one of future |
| 72 | + releases. |
| 73 | + |
| 74 | + Python 2 support was dropped. We test the connector since Python 3.5 to 3.10. |
| 75 | + The new connection pool requires Python 3.7 or newer. |
| 76 | + |
| 77 | + Msgpack string/binary types mapping from/to Python types was changed. The |
| 78 | + behaviour is the following. |
| 79 | + |
| 80 | + **tarantool-python 0.7.1 and older:** |
| 81 | + |
| 82 | + * `encoding='utf-8'` (default) |
| 83 | + |
| 84 | + | Python 3 | -> | Tarantool | -> | Python 3 | |
| 85 | + |----------|----|--------------------|----|----------| |
| 86 | + | str | -> | mp_str (string) | -> | str | |
| 87 | + | bytes | -> | mp_str (string) | -> | str | |
| 88 | + | | | mp_bin (varbinary) | -> | bytes | |
| 89 | + |
| 90 | + * `encoding=None` |
| 91 | + |
| 92 | + | Python 3 | -> | Tarantool | -> | Python 3 | |
| 93 | + |----------|----|--------------------|----|----------| |
| 94 | + | bytes | -> | mp_str (string) | -> | bytes | |
| 95 | + | str | -> | mp_str (string) | -> | bytes | |
| 96 | + | | | mp_bin (varbinary) | -> | bytes | |
| 97 | + |
| 98 | + **tarantool-python 0.8.0 and newer:** |
| 99 | + |
| 100 | + * `encoding='utf-8'` (default) |
| 101 | + |
| 102 | + | Python 3 | -> | Tarantool | -> | Python 3 | |
| 103 | + |----------|----|--------------------|----|----------| |
| 104 | + | str | -> | mp_str (string) | -> | str | |
| 105 | + | bytes | -> | mp_bin (varbinary) | -> | bytes | |
| 106 | + |
| 107 | + * `encoding=None` |
| 108 | + |
| 109 | + | Python 3 | -> | Tarantool | -> | Python 3 | |
| 110 | + |----------|----|--------------------|----|----------| |
| 111 | + | bytes | -> | mp_str (string) | -> | bytes | |
| 112 | + | str | -> | mp_str (string) | -> | bytes | |
| 113 | + | | | mp_bin (varbinary) | -> | bytes | |
| 114 | + |
| 115 | + If you use `varbinary` for storing binary data (and `string` for ASCII or |
| 116 | + UTF-8 texts), default `encoding='utf-8'` mode should work fine. |
| 117 | + |
| 118 | + If binary data is stored in `string` fields, consider `encoding=None` |
| 119 | + parameter. |
| 120 | + |
| 121 | + ## New features |
| 122 | + |
| 123 | + - Connection pool with master discovery (#196, PR #207). |
| 124 | + |
| 125 | + `ConnectionPool` is supported only for Python 3.7 or newer. |
| 126 | + |
| 127 | + Authenticated user must be able to call `box.info` on instances. |
| 128 | + |
| 129 | + `ConnectionPool` updates information about each server state (RO/RW) on |
| 130 | + initial connect and then asynchronously in separate threads. Application |
| 131 | + retries must be written considering the asynchronous nature of cluster state |
| 132 | + refresh. User does not need to use any synchronization mechanisms in |
| 133 | + requests, it's all handled with `ConnectionPool` methods. |
| 134 | + |
| 135 | + `ConnectionPool` API is the same as a plain Connection API. On each request, |
| 136 | + a connection is chosen to execute this request. A connection is chosen based |
| 137 | + on a request mode: |
| 138 | + |
| 139 | + * `Mode.ANY` chooses any instance. |
| 140 | + * `Mode.RW` chooses an RW instance. |
| 141 | + * `Mode.RO` chooses an RO instance. |
| 142 | + * `Mode.PREFER_RW` chooses an RW instance, if possible, RO instance |
| 143 | + otherwise. |
| 144 | + * `Mode.PREFER_RO` chooses an RO instance, if possible, RW instance |
| 145 | + otherwise. |
| 146 | + |
| 147 | + `insert`, `replace`, `delete`, `upsert`, `update` use RW mode by default. |
| 148 | + |
| 149 | + `select` uses ANY by default. |
| 150 | + |
| 151 | + `call`, `eval`, `execute` and `ping` require to set the mode explicitly. |
| 152 | + - **[Breaking]** `varbinary` field type is now fully supported and does not |
| 153 | + fail on decoding of non-UTF-8 data (#105, PR #211). |
| 154 | + |
| 155 | + It requires incompatible binary/string marshalling changes. See the |
| 156 | + 'Breaking changes' section for details. |
| 157 | + - Support a value of `bytes` type as a key for `delete`, `update`, `select` |
| 158 | + (#105, PR #211). |
| 159 | + |
| 160 | + Now `bytes` can be used as keys in all methods. |
| 161 | + |
| 162 | + ## Bugfixes |
| 163 | + |
| 164 | + - Hold string representation of a response object (PR #186). |
| 165 | + |
| 166 | + We want to keep it the same for different Python versions. It sometimes |
| 167 | + useful for writing tests using the connector. |
| 168 | + - Unix sockets in `MeshConnection` are now supported (#111, PR #189). |
| 169 | + |
| 170 | + It was supported in 0.6.5, but broken then in 0.6.6. |
| 171 | + |
| 172 | + ## Testing |
| 173 | + |
| 174 | + - Migrated CI to GitHub Actions (#182, PR #213, PR #216). |
| 175 | + - Added a workflow for integration testing of tarantool's changes against this |
| 176 | + connector (PR #192). |
| 177 | + - Dropped test-run submodule (#111, PR #189). |
| 178 | + - Run SQL tests only on tarantool 2.X (#194, PR #195). |
| 179 | + |
| 180 | + ## Other |
| 181 | + |
| 182 | + - Fixed formatting and wording in README (PR #215). |
| 183 | + - Clarified license of the project (BSD-2-Clause) (#197, PR #210). |
| 184 | + |
| 185 | + -- Alexander Turenko < [email protected]> Fri, 29 Apr 2022 22:30:00 +0300 |
| 186 | + |
1 | 187 | tarantool-python (0.7.1-0) unstable; urgency=medium
|
2 | 188 |
|
3 | 189 | ## Overview
|
|
0 commit comments