Skip to content

Commit cc6445e

Browse files
committed
Added typing stub file
1 parent 5cdf4b3 commit cc6445e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

libsql_experimental.pyi

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
LEGACY_TRANSACTION_CONTROL: int = -1
10+
11+
12+
@final
13+
class Cursor:
14+
"""libSQL database cursor.
15+
16+
Implements a superset of the [DB-API 2.0 (PEP249)](https://peps.python.org/pep-0249/) Cursor object protocol.""" # noqa: E501
17+
arraysize: int
18+
19+
@property
20+
def description(self) -> tuple[tuple[Any, ...], ...] | None: ...
21+
22+
@property
23+
def rowcount(self) -> int: ...
24+
25+
@property
26+
def lastrowid(self) -> int | None: ...
27+
28+
def close(self) -> None: ...
29+
def execute(self, sql: str, parameters: tuple[Any, ...] = ...) -> Self: ...
30+
def executemany(self, sql: str, parameters: list[tuple[Any, ...]] = ...) -> Self: ... # noqa: E501
31+
def executescript(self, script: str) -> Self: ...
32+
def fetchone(self) -> tuple[Any, ...] | None: ...
33+
def fetchmany(self, size: int = ...) -> list[tuple[Any, ...]]: ... # noqa: E501
34+
def fetchall(self) -> list[tuple[Any, ...]]: ...
35+
36+
37+
@final
38+
class Connection:
39+
"""libSQL database connection.
40+
41+
Implements a superset of the [DB-API 2.0 (PEP249)](https://peps.python.org/pep-0249/) Connection object protocol.""" # noqa: E501
42+
@property
43+
def isolation_level(self) -> str | None: ...
44+
45+
@property
46+
def in_transaction(self) -> bool: ...
47+
48+
def commit(self) -> None: ...
49+
def cursor(self) -> Cursor: ...
50+
def sync(self) -> None: ...
51+
def rollback(self) -> None: ...
52+
def execute(self, sql: str, parameters: tuple[Any, ...] = ...) -> Cursor: ... # noqa: E501
53+
def executemany(self, sql: str, parameters: list[tuple[Any, ...]] = ...) -> Cursor: ... # noqa: E501
54+
def executescript(self, script: str) -> None: ...
55+
56+
57+
def connect(database: str,
58+
isolation_level: str | None = ...,
59+
check_same_thread: bool = True,
60+
uri: bool = False,
61+
sync_url: str = ...,
62+
sync_interval: float = ...,
63+
auth_token: str = ...,
64+
encryption_key: str = ...) -> Connection:
65+
"""Open a new libSQL connection, return a Connection object."""

0 commit comments

Comments
 (0)