diff --git a/stubs/hdbcli/@tests/stubtest_allowlist.txt b/stubs/hdbcli/@tests/stubtest_allowlist.txt index e13c2f2b127b..0a8477f582f6 100644 --- a/stubs/hdbcli/@tests/stubtest_allowlist.txt +++ b/stubs/hdbcli/@tests/stubtest_allowlist.txt @@ -8,3 +8,16 @@ hdbcli.dbapi.ExecuteManyErrorEntry.rownumber hdbcli.dbapi.buffer hdbcli.dbapi.long hdbcli.dbapi.unicode + +# async_connect is an alias for AsyncConnection, but at runtime its a function +hdbcli.dbapi.async_connect + +# *args/**kwargs are not added by purpose but are part of the python wrapper +hdbcli.dbapi.AsyncLob.close +hdbcli.dbapi.AsyncCursor.nextset +hdbcli.dbapi.AsyncCursor.fetchall +hdbcli.dbapi.AsyncCursor.close +hdbcli.dbapi.AsyncConnection.rollback +hdbcli.dbapi.AsyncConnection.commit +hdbcli.dbapi.AsyncConnection.close +hdbcli.dbapi.AsyncConnection.cancel diff --git a/stubs/hdbcli/METADATA.toml b/stubs/hdbcli/METADATA.toml index 844c9ace86f2..2bc0cad45c11 100644 --- a/stubs/hdbcli/METADATA.toml +++ b/stubs/hdbcli/METADATA.toml @@ -1,2 +1,2 @@ -version = "2.25.*" +version = "2.29.*" # upstream-repository = closed-source diff --git a/stubs/hdbcli/hdbcli/dbapi.pyi b/stubs/hdbcli/hdbcli/dbapi.pyi index c3e0bc03ce98..4acfa34cdcfd 100644 --- a/stubs/hdbcli/hdbcli/dbapi.pyi +++ b/stubs/hdbcli/hdbcli/dbapi.pyi @@ -40,6 +40,7 @@ class Connection: def setautocommit(self, auto: bool = ...) -> None: ... def setclientinfo(self, key: str, value: str | None = ...) -> None: ... def ontrace(self, callback: Callable[[str], Any], options: str = ...) -> None: ... + def ping(self) -> bool: ... connect = Connection @@ -143,3 +144,50 @@ DATETIME: type[date | time | datetime] STRING = str BINARY = memoryview ROWID = int + +class AsyncConnection(Connection): + @classmethod + async def create( + cls, + address: str = "", + port: int = 0, + user: str = "", + password: str = "", + autocommit: bool = True, + packetsize: int | None = None, + userkey: str | None = ..., + *, + sessionvariables: dict[str, str] | None = ..., + forcebulkfetch: bool | None = ..., + ) -> Self: ... + async def cancel(self) -> bool: ... # type: ignore[override] + async def close(self) -> None: ... # type: ignore[override] + async def commit(self) -> None: ... # type: ignore[override] + async def cursor(self) -> AsyncCursor: ... # type: ignore[override] + async def rollback(self) -> None: ... # type: ignore[override] + +class AsyncCursor(Cursor): + async def callproc(self, procname: str, parameters: tuple[Any, ...] = ..., overview: bool = ...) -> tuple[Any, ...]: ... # type: ignore[override] + async def close(self) -> None: ... # type: ignore[override] + async def execute(self, operation: str, parameters: tuple[Any, ...] | None = ...) -> bool: ... # type: ignore[override] + async def executemany(self, operation: str, parameters: _Parameters = ..., batcherrors: bool = False) -> Any: ... + async def executemanyprepared(self, parameters: _Parameters = ...) -> Any: ... + async def executeprepared(self, parameters: _Parameters = ...) -> Any: ... + async def fetchone(self, uselob: bool = ...) -> ResultRow | None: ... # type: ignore[override] + async def fetchall(self) -> list[ResultRow]: ... # type: ignore[override] + async def fetchmany(self, size: int | None = ...) -> list[ResultRow]: ... # type: ignore[override] + async def nextset(self) -> None: ... # type: ignore[override] + async def prepare(self, operation: str, newcursor: bool = ...) -> Any: ... # type: ignore[override] + async def scroll(self, value: int, mode: Literal["absolute", "relative"] = ...) -> None: ... # type: ignore[override] + async def __aenter__(self) -> Self: ... + async def __aexit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... + +class AsyncLob(LOB): + async def close(self) -> None: ... # type: ignore[override] + async def find(self, object: str, length: int, position: int = ...) -> int: ... # type: ignore[override] + async def read(self, size: int = ..., position: int = ...) -> str | bytes: ... # type: ignore[override] + async def write(self, object: str | bytes) -> int: ... # type: ignore[override] + +async_connect = AsyncConnection + +def set_async_mode(enabled: bool = True) -> None: ...