class Connection

class tarantool.connection.Connection(host, port, socket_timeout=None, reconnect_max_attempts=10, reconnect_delay=0.1, connect_now=True, schema=None, return_tuple=True)

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.
Parameters:schema (Schema or dict) – Data schema (see Developer guide and Schema)
call(func_name, *args[, return_tuple])

Execute CALL request. Call stored Lua function.

Parameters:
  • func_name (str) – stored Lua function name
  • args (list or tuple) – list of function arguments
  • return_tuple (bool) – True indicates that it is required to return the inserted tuple back
  • field_defs (None or [(name, type) or None]) – field definitions used for types conversion, e.g. [(‘field0’, tarantool.NUM), (‘field1’, tarantool.STR)]
  • default_type (None or int) – None a default type used for result conversion, as defined in schema[space_no]['default_type']
  • space_name (None or int or str) – space number or name. A schema for the space will be used for type conversion.
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

Previous topic

module tarantool

Next topic

class Schema

This Page