|
4 | 4 | This module provides low-level API for Tarantool |
5 | 5 | ''' |
6 | 6 |
|
| 7 | +import os |
7 | 8 | import six |
| 9 | +import copy |
8 | 10 | import time |
9 | 11 | import errno |
10 | 12 | import ctypes |
11 | 13 | import ctypes.util |
12 | 14 | import socket |
13 | 15 | import msgpack |
14 | | -import os |
15 | 16 |
|
16 | 17 | try: |
17 | 18 | from ctypes import c_ssize_t |
@@ -429,6 +430,15 @@ class JoinState: |
429 | 430 | if state == JoinState.Done: |
430 | 431 | return |
431 | 432 |
|
| 433 | + def _ops_process(self, space, update_ops): |
| 434 | + new_ops = [] |
| 435 | + for op in update_ops: |
| 436 | + if isinstance(op[1], six.string_types): |
| 437 | + op = list(op) |
| 438 | + op[1] = self.schema.get_field(space, op[1])['id'] |
| 439 | + new_ops.append(op) |
| 440 | + return new_ops |
| 441 | + |
432 | 442 | def join(self, server_uuid): |
433 | 443 | self._opt_reconnect() |
434 | 444 | if self.version_id < version_id(1, 7, 0): |
@@ -555,6 +565,7 @@ def upsert(self, space_name, tuple_value, op_list, **kwargs): |
555 | 565 | space_name = self.schema.get_space(space_name).sid |
556 | 566 | if isinstance(index_name, six.string_types): |
557 | 567 | index_name = self.schema.get_index(space_name, index_name).iid |
| 568 | + op_list = self._ops_process(space_name, op_list) |
558 | 569 | request = RequestUpsert(self, space_name, index_name, tuple_value, |
559 | 570 | op_list) |
560 | 571 | return self._send_request(request) |
@@ -629,6 +640,7 @@ def update(self, space_name, key, op_list, **kwargs): |
629 | 640 | space_name = self.schema.get_space(space_name).sid |
630 | 641 | if isinstance(index_name, six.string_types): |
631 | 642 | index_name = self.schema.get_index(space_name, index_name).iid |
| 643 | + op_list = self._ops_process(space_name, op_list) |
632 | 644 | request = RequestUpdate(self, space_name, index_name, key, op_list) |
633 | 645 | return self._send_request(request) |
634 | 646 |
|
|
0 commit comments