asynctnt

Subpackages

Submodules

Package Contents

Classes

Connection

Db

Field

IProtoError

IProtoErrorStackFrame

Metadata

PushIterator

Response

Schema

SchemaIndex

SchemaSpace

TarantoolTuple

Functions

connect(→ Connection)

connect shorthand. See asynctnt.Connection for kwargs details

Attributes

__version__

class asynctnt.Connection(*, host: str = '127.0.0.1', port: int | str = 3301, username: str | None = None, password: str | None = None, fetch_schema: bool = True, auto_refetch_schema: bool = True, connect_timeout: float = 3.0, request_timeout: float = -1.0, reconnect_timeout: float = 1.0 / 3.0, ping_timeout: float = 5.0, encoding: str | None = None, initial_read_buffer_size: int | None = None)[source]

Bases: asynctnt.api.Api

property fingerprint: str
property host: str

Tarantool host

property port: int

Tarantool port

property username: str | None

Tarantool username

property password: str | None

Tarantool password

property fetch_schema: bool

fetch_schema flag

property auto_refetch_schema: bool

auto_refetch_schema flag

property encoding: str

Connection encoding

property reconnect_timeout: float

Reconnect timeout value

property connect_timeout: float

Connect timeout value

property request_timeout: float

Request timeout value

property version: tuple | None

Protocol version tuple. ex.: (1, 6, 7)

property state: ConnectionState

Current connection state

Return type:

ConnectionState

property is_connected: bool

Check if an underlying connection is active

property is_fully_connected: bool

Check if connection is fully active (performed auth and schema fetching)

property schema_id: int | None

Tarantool’s current schema id

property schema: asynctnt.iproto.protocol.Schema | None

Current Tarantool schema with all spaces, indexes and fields

property initial_read_buffer_size: int

initial_read_buffer_size value

__slots__ = ('_host', '_port', '_username', '_password', '_fetch_schema', '_auto_refetch_schema',...
_set_state(new_state: ConnectionState)[source]
connection_lost(exc)[source]
async _ping_task_func()[source]
_start_reconnect(return_exceptions: bool = False)[source]
protocol_factory(connected_fut: asyncio.Future, loop: asyncio.AbstractEventLoop, cls: Type[asynctnt.iproto.protocol.Protocol] = protocol.Protocol)[source]
async _connect(return_exceptions: bool = True)[source]
async _wait_reconnect(exc: Exception | None = None)[source]
async connect() Connection[source]

Connect coroutine

async disconnect()[source]

Disconnect coroutine

close()[source]

Same as disconnect, but not a coroutine, i.e. it does not wait for disconnect to finish.

async reconnect()[source]

Reconnect coroutine. Just calls disconnect() and connect()

async __aenter__()[source]

Executed on entering the async with section. Connects to Tarantool instance.

async __aexit__(exc_type, exc_val, exc_tb)[source]

Executed on leaving the async with section. Disconnects from Tarantool instance.

async refetch_schema()[source]

Coroutine to force refetch schema

_normalize_api()[source]
__repr__()[source]

Return repr(self).

stream() asynctnt.stream.Stream[source]

Create new stream suitable for interactive transactions

async asynctnt.connect(**kwargs) Connection[source]

connect shorthand. See asynctnt.Connection for kwargs details

Returns:

asynctnt.Connection object

class asynctnt.Db[source]
property stream_id: int
set_stream_id(stream_id: int)[source]
ping(timeout: float = -1)[source]
call16(func_name: str, args=None, timeout: float = -1, push_subscribe: bool = False)[source]
call(func_name: str, args=None, timeout: float = -1, push_subscribe: bool = False)[source]
eval(expression: str, args=None, timeout: float = -1, push_subscribe: bool = False)[source]
select(space, key=None, offset: int = 0, limit: int = 4294967295, index=0, iterator=0, timeout: float = -1, check_schema_change: bool = True)[source]
insert(space, t, replace: bool = False, timeout: float = -1)[source]
replace(space, t, timeout: float = -1)[source]
delete(space, key, index=0, timeout: float = -1)[source]
update(space, key, operations, index=0, timeout: float = -1)[source]
upsert(space, t, operations, timeout: float = -1)[source]
execute(query, args, parse_metadata: bool = True, timeout: float = -1)[source]
prepare(query, parse_metadata: bool = True, timeout: float = -1)[source]
begin(isolation: int, tx_timeout: float, timeout: float = -1)[source]
commit(timeout: float = -1)[source]
rollback(timeout: float = -1)[source]
class asynctnt.Field[source]
name: str | None

Field name

type: str | None

Field type

collation: str | None

Field collation value

is_nullable: bool | None

If field may be null

is_autoincrement: bool | None

Is Autoincrement

span: str | None
class asynctnt.IProtoError[source]
trace: List[IProtoErrorStackFrame]
class asynctnt.IProtoErrorStackFrame[source]
error_type: str
file: str
line: int
message: str
err_no: int
code: int
fields: Dict[str, Any]
class asynctnt.Metadata[source]
fields: List[Field]

List of fields

name_id_map: Dict[str, int]

Mapping name -> id

class asynctnt.PushIterator(fut: asyncio.Future)[source]
property response: Response
__iter__()[source]
__next__()[source]
__aiter__()[source]
async __anext__()[source]
class asynctnt.Response[source]
property sync: int
property code: int
property return_code: int
property schema_id: int
property stmt_id: int
property rowcount: int
errmsg: str | None
error: IProtoError | None
encoding: bytes
autoincrement_ids: List[int] | None
body: List[BodyItem] | None
metadata: Metadata | None
params: Metadata | None
params_count: int
done() bool[source]
__len__() int[source]
__getitem__(i) BodyItem[source]
__iter__()[source]
class asynctnt.Schema[source]
id: int
spaces: Dict[str | int, SchemaSpace]
class asynctnt.SchemaIndex[source]
iid: int

Index id

sid: int

Space id

name: str | None
index_type: str | None
unique: bool | None
metadata: Metadata | None
class asynctnt.SchemaSpace[source]
sid: int
owner: int
name: str | None
engine: str | None
field_count: int
flags: Any | None
metadata: Metadata | None
indexes: Dict[int | str, SchemaIndex]
class asynctnt.TarantoolTuple[source]
__repr__() str[source]

Return repr(self).

__index__(i: int) Any[source]
__len__() int[source]
__contains__(item: str) bool[source]
__getitem__(item: int | str | slice) Any[source]
keys() Iterator[str][source]
values() Iterator[Any][source]
items() Iterator[Tuple[str, Any]][source]
get(item: str) Any | None[source]
__iter__()[source]
__next__()[source]
asynctnt.__version__ = '2.2.0'[source]