Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make use_list param configurable
It is set up to be converted to lists by default. Django expects row
type to be tuple. Also tuples tend to perform better than lists and
it is good if it can be configurable.

Closes #166
  • Loading branch information
artembo committed Oct 30, 2020
commit 00d315b31d4f2373ea199497fa9a64996eaed89a
2 changes: 2 additions & 0 deletions tarantool/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def __init__(self, host, port,
reconnect_delay=RECONNECT_DELAY,
connect_now=True,
encoding=ENCODING_DEFAULT,
use_list=True,
call_16=False,
connection_timeout=CONNECTION_TIMEOUT):
'''
Expand Down Expand Up @@ -132,6 +133,7 @@ def __init__(self, host, port,
self.connected = False
self.error = True
self.encoding = encoding
self.use_list = use_list
self.call_16 = call_16
self.connection_timeout = connection_timeout
if connect_now:
Expand Down
5 changes: 3 additions & 2 deletions tarantool/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ def __init__(self, conn, response):

unpacker_kwargs = dict()

# Decode msgpack arrays into Python lists (not tuples).
unpacker_kwargs['use_list'] = True
# Decode msgpack arrays into Python lists by default (not tuples).
# Can be configured in the Connection init
unpacker_kwargs['use_list'] = conn.use_list

# Use raw=False instead of encoding='utf-8'.
if msgpack.version >= (0, 5, 2) and conn.encoding == 'utf-8':
Expand Down