|
| 1 | +"""libSQL's experimental Python implementation""" |
| 2 | + |
| 3 | +from typing import Any, Self, final |
| 4 | + |
| 5 | + |
| 6 | +paramstyle = "qmark" |
| 7 | +sqlite_version_info = (3, 42, 0) |
| 8 | +Error = Exception |
| 9 | + |
| 10 | + |
| 11 | +@final |
| 12 | +class Cursor: |
| 13 | + """libSQL database cursor. |
| 14 | + |
| 15 | + Implements a superset of the [DB-API 2.0 (PEP249)](https://peps.python.org/pep-0249/) Cursor object protocol.""" # noqa: E501 |
| 16 | + arraysize: int |
| 17 | + |
| 18 | + @property |
| 19 | + def description(self) -> tuple[tuple[Any, ...], ...] | None: ... |
| 20 | + |
| 21 | + @property |
| 22 | + def rowcount(self) -> int: ... |
| 23 | + |
| 24 | + @property |
| 25 | + def lastrowid(self) -> int | None: ... |
| 26 | + |
| 27 | + def close(self) -> None: ... |
| 28 | + def execute(self, sql: str, parameters: tuple[Any] = ...) -> Self: ... |
| 29 | + def executemany(self, sql: str, parameters: list[tuple[Any, ...]] = ...) -> Self: ... # noqa: E501 |
| 30 | + def fetchone(self) -> tuple[Any] | None: ... |
| 31 | + def fetchmany(self, size: int = ...) -> list[tuple[Any, ...]]: ... # noqa: E501 |
| 32 | + def fetchall(self) -> list[tuple[Any, ...]]: ... |
| 33 | + |
| 34 | + |
| 35 | +@final |
| 36 | +class Connection: |
| 37 | + """libSQL database connection. |
| 38 | + |
| 39 | + Implements a superset of the [DB-API 2.0 (PEP249)](https://peps.python.org/pep-0249/) Connection object protocol.""" # noqa: E501 |
| 40 | + @property |
| 41 | + def isolation_level(self) -> str | None: ... |
| 42 | + |
| 43 | + @property |
| 44 | + def in_transaction(self) -> bool: ... |
| 45 | + |
| 46 | + def commit(self) -> None: ... |
| 47 | + def cursor(self) -> Cursor: ... |
| 48 | + def sync(self) -> None: ... |
| 49 | + def rollback(self) -> None: ... |
| 50 | + def execute(self, sql: str, parameters: tuple[Any] = ...) -> Cursor: ... |
| 51 | + def executemany(self, sql: str, parameters: list[tuple[Any, ...]] = ...) -> Cursor: ... # noqa: E501 |
| 52 | + def executescript(self, script: str) -> None: ... |
| 53 | + |
| 54 | + |
| 55 | +def connect(database: str, |
| 56 | + isolation_level: str | None = ..., |
| 57 | + check_same_thread: bool = True, |
| 58 | + uri: bool = False, |
| 59 | + sync_url: str = ..., |
| 60 | + sync_interval: float = ..., |
| 61 | + auth_token: str = ..., |
| 62 | + encryption_key: str = ...) -> Connection: |
| 63 | + """Open a new libSQL connection, return a Connection object.""" |
| 64 | + ... |
0 commit comments