You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My data in tarantool stored as binary strings, they are not UTF in any manner. It's just a sequence of bytes.
When trying to select data with this module , unpacker fails with error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/tarantool/space.py", line 75, in select
return self.connection.select(self.space_no, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tarantool/connection.py", line 775, in select
response = self._send_request(request)
File "/usr/local/lib/python3.6/dist-packages/tarantool/connection.py", line 357, in _send_request
return self._send_request_wo_reconnect(request)
File "/usr/local/lib/python3.6/dist-packages/tarantool/connection.py", line 264, in _send_request_wo_reconnect
response = Response(self, self._read_response())
File "/usr/local/lib/python3.6/dist-packages/tarantool/response.py", line 62, in __init__
self._body = unpacker.unpack()
File "msgpack/_unpacker.pyx", line 519, in msgpack._unpacker.Unpacker.unpack
File "msgpack/_unpacker.pyx", line 499, in msgpack._unpacker.Unpacker._unpack
msgpack.exceptions.UnpackValueError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Any success with fixing that? Still have that problem with Tarantool 2.2 and connector 0.6.6 even when I don't select binary data from a space containing it
>> print(result)
- None
- b'Type mismatch: can not convert 'REDACTED BINARY STRING' to varbinary'
And honestly I don't understand what encodings have to do when it comes to raw binary data. Like shouldn't it be just directly converted to bytes Python type?
A user store binary (non-utf-8 data) in a 'string' field and don't want data being encoded or decoded when working with this field. May be worked around as shown above.
A user want to send / receive mp_bin to work with a 'varbinary' field. Everything looks okay on decoding side (mp_bin is decoded to bytes), but a bytes value is encoded as mp_str. Maybe we can change it on Python 3 (RFC patch).
NB: Propose to msgpack-python to provide helpers like msgpack.as_bin() and msgpack.as_str() to encode a particular structure (dict, list, tuple) member as mp_bin or mp_str disregarding use_bin_type option. It may be requirement of an msgpack-based protocol to have a string here and a binary value there (exactly our case).
Activity
31hkim commentedon May 19, 2020
Any success with fixing that? Still have that problem with Tarantool 2.2 and connector 0.6.6 even when I don't select binary data from a space containing it
Totktonada commentedon May 19, 2020
It seems, we cannot just set
encodingtoNonewhen creating a connection, because at least schema reload does not support this.However we can temporary set encoding to
None:NB: File another issue for
Connection(host, port, encoding=None)support.31hkim commentedon May 20, 2020
Now I'm getting this:
And honestly I don't understand what encodings have to do when it comes to raw binary data. Like shouldn't it be just directly converted to
bytesPython type?WIP: Encode bytes as mp_bin on Python 3
Totktonada commentedon May 20, 2020
Okay, two different problems are discussed here:
bytes), but abytesvalue is encoded as mp_str. Maybe we can change it on Python 3 (RFC patch).31hkim commentedon May 21, 2020
Ah, sorry for confusion, and thank you. Will wait for a complete fix
31hkim commentedon May 28, 2020
Any success?
Totktonada commentedon Jul 8, 2020
We're at planning of Q3 tasks and I hope this one will be included here. I'll specifically mark it as important.
schema: support encoding=None connections
Totktonada commentedon Aug 28, 2020
NB: Propose to msgpack-python to provide helpers like msgpack.as_bin() and msgpack.as_str() to encode a particular structure (dict, list, tuple) member as mp_bin or mp_str disregarding
use_bin_typeoption. It may be requirement of an msgpack-based protocol to have a string here and a binary value there (exactly our case).Usage example:
schema: support encoding=None connections
schema: support encoding=None connections
schema: support encoding=None connections
25 remaining items
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
types: support working with binary for Python 3
Update python connector comparison table
Update python connector comparison table
Update python connector comparison table
Update python connector comparison table (#2863)