GitHub

API reference for sdk.

What the libSQL client runs statements on (@libsql/client's Client and Transaction, the part Effect's driver uses).

LibsqlSdk and LibsqlSdkTransaction are async: the client awaits them on pyfect's SQL loop thread (pyfect.sql._loop), so a caller-owned client (LibsqlLiveConfig) must be usable from that loop. The client makes its own for a file: / :memory: database (sqlite3) or a remote server (Hrana over HTTP).

Types

TypeDefinitionDescription
Valuetype Value = int | float | str | bytes | None

A value as libSQL stores it.

TransactionModetype TransactionMode = Literal['write', 'read', 'deferred']

write starts with BEGIN IMMEDIATE, read with BEGIN TRANSACTION READONLY (a libSQL server's), deferred with BEGIN DEFERRED.

SdkProtocoltype SdkProtocol = Literal['http', 'ws', 'file']

How a client reaches its database (@libsql/client's protocol): remote transports run each statement and transaction on a stream of its own; a file client may have a single connection.

Classes

Functions

begin_statement

begin_statement(mode) -> str
ParameterTypeDescription
modeTransactionMode

Returns str

def begin_statement(mode: TransactionMode) -> str:
    return _BEGIN[mode]