class Connection

class tarantool.connection.Connection(host, port, user=None, password=None, socket_timeout=None, reconnect_max_attempts=10, reconnect_delay=0.1, connect_now=True, encoding=None, call_16=False)

Represents connection to the Tarantool server.

This class is responsible for connection and network exchange with the server. Also this class provides low-level interface to data manipulation (insert/delete/update/select).

Initialize a connection to the server.

Parameters:
  • host (str) – Server hostname or IP-address
  • port (int) – Server port
  • connect_now (bool) – if True (default) than __init__() actually
creates network connection.
if False than you have to call connect() manualy.
call(func_name, *args)

Execute CALL request. Call stored Lua function.

Parameters:
  • func_name (str) – stored Lua function name
  • args (list or tuple) – list of function arguments
Return type:

Response instance

close()

Close connection to the server

ping(notime=False)

Execute PING request. Send empty request and receive empty response from server.

Returns:response time in seconds
Return type:float
space(space_name)

Create Space instance for particular space

Space instance encapsulates the identifier of the space and provides more convenient syntax for accessing the database space.

Parameters:space_name (int or str) – identifier of the space
Return type:Space instance