module tarantool.response

Request response types definitions.

class tarantool.response.Response(conn, response)

Represents a single response from the server in compliance with the Tarantool protocol. Responsible for data encapsulation (i.e. received list of tuples) and parsing of binary packets received from the server.

Parameters:
Raise:

DatabaseError, SchemaReloadException

property body
Type:

dict

Raw response body.

property code
Type:

int

Response type id.

count(value)

Refer to collections.abc.Sequence.

Raises:

InterfaceError

property data
Type:

object

Contains the list of tuples for SELECT, REPLACE and DELETE requests and arbitrary data for CALL.

index(*args)

Refer to collections.abc.Sequence.

Raises:

property return_code
Type:

int

If the request was successful, the value of is 0. Otherwise, it contains an error code. If the value is non-zero, return_message contains an error message.

property return_message
Type:

str

The error message returned by the server in case of non-zero return_code (empty string otherwise).

property rowcount
Type:

int

Number of rows affected or returned by a query.

property schema_version
Type:

int

Request current schema version.

property strerror

Refer to tnt_strerror().

property sync
Type:

int

Response header IPROTO_SYNC.

class tarantool.response.ResponseExecute(conn, response)

Represents an SQL EXECUTE request response.

Parameters:
Raise:

DatabaseError, SchemaReloadException

property affected_row_count

The number of changed rows for responses to DML requests and None for DQL requests.

Return type:

int or None

property autoincrement_ids

A list with the new primary-key value (or values) for an INSERT in a table defined with PRIMARY KEY AUTOINCREMENT (NOT result set size).

Return type:

list or None

property body
Type:

dict

Raw response body.

property code
Type:

int

Response type id.

count(value)

Refer to collections.abc.Sequence.

Raises:

InterfaceError

property data
Type:

object

Contains the list of tuples for SELECT, REPLACE and DELETE requests and arbitrary data for CALL.

index(*args)

Refer to collections.abc.Sequence.

Raises:

property return_code
Type:

int

If the request was successful, the value of is 0. Otherwise, it contains an error code. If the value is non-zero, return_message contains an error message.

property return_message
Type:

str

The error message returned by the server in case of non-zero return_code (empty string otherwise).

property rowcount
Type:

int

Number of rows affected or returned by a query.

property schema_version
Type:

int

Request current schema version.

property strerror

Refer to tnt_strerror().

property sync
Type:

int

Response header IPROTO_SYNC.

class tarantool.response.ResponseProtocolVersion(conn, response)

Represents an ID request response: information about server protocol version and features it supports.

Parameters:
Raise:

DatabaseError, SchemaReloadException

property auth_type

Server expected authentication method.

Return type:

str or None

property body
Type:

dict

Raw response body.

property code
Type:

int

Response type id.

count(value)

Refer to collections.abc.Sequence.

Raises:

InterfaceError

property data
Type:

object

Contains the list of tuples for SELECT, REPLACE and DELETE requests and arbitrary data for CALL.

property features

Server supported features.

Return type:

list

index(*args)

Refer to collections.abc.Sequence.

Raises:

property protocol_version

Server protocol version.

Return type:

int or None

property return_code
Type:

int

If the request was successful, the value of is 0. Otherwise, it contains an error code. If the value is non-zero, return_message contains an error message.

property return_message
Type:

str

The error message returned by the server in case of non-zero return_code (empty string otherwise).

property rowcount
Type:

int

Number of rows affected or returned by a query.

property schema_version
Type:

int

Request current schema version.

property strerror

Refer to tnt_strerror().

property sync
Type:

int

Response header IPROTO_SYNC.

tarantool.response.unpacker_factory(conn)

Build unpacker to unpack request response.

Parameters:

conn (Connection) – Request sender.

Return type:

msgpack.Unpacker