class Space

class tarantool.space.Space(connection, space_name)

Object-oriented wrapper for accessing a particular space. Encapsulates the identifier of the space and provides more convenient syntax for database operations.

Create Space instance.

Parameters:
  • connection (Connection instance) – Object representing connection to the server
  • space_no (int) – space no or name to insert a record
call(func_name, *args, **kwargs)

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

delete(key, return_tuple=False)

Delete records by its primary key.

Parameters:
  • key – key of records to be deleted
  • return_tuple (bool) – True indicates that it is required to return the inserted tuple back
Return type:

Response instance

insert(values, return_tuple=False)

Insert single record into the space.

Parameters:
  • values (tuple) – record to be inserted. The tuple must contain only scalar (integer or strings) values
  • return_tuple (boo) – True indicates that it is required to return the inserted tuple back
Return type:

Response instance

select(values, **kwargs)

Execute SELECT request. Select and retrieve data from the database.

Parameters:
  • values (list of tuples) – list of values to search over the index
  • index (int) – specifies which index to use (default is 0 which means that the primary index will be used)
  • offset (int) – offset in the resulting tuple set
  • limit (int) – limits the total number of returned tuples
Return type:

Response instance

update(key, op_list, return_tuple=False)

Update records by it’s primary key with operations defined in op_list

Parameters:
  • key – key of records to be updated
  • return_tuple (bool) – True indicates that it is required to return the inserted tuple back
Return type:

Response instance

Previous topic

class Schema

Next topic

class Response

This Page