Add stubs for hdbcli (#6550)

hdbcli is the python dbapi for SAP HANA. Not all methods/attributes are 100% compatible with PEP 249.
This commit is contained in:
kasium
2021-12-09 14:29:06 +01:00
committed by GitHub
parent 65f0e8b770
commit f929d30ec0
5 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
hdbcli.dbapi.Error.errorcode
hdbcli.dbapi.Error.errortext
hdbcli.dbapi.Warning.errorcode
hdbcli.dbapi.Warning.errortext

View File

@@ -0,0 +1 @@
version = "2.10.*"

View File

@@ -0,0 +1 @@
__version__: str

View File

@@ -0,0 +1,115 @@
import decimal
from _typeshed import ReadableBuffer
from datetime import date, datetime, time
from typing import Any, Sequence, Tuple, Type, overload
from typing_extensions import Literal
from .resultrow import ResultRow
apilevel: str
threadsafety: int
paramstyle: Tuple[str, ...]
connect = Connection
class Connection:
def __init__(
self,
address: str,
port: int,
username: str,
password: str,
autocommit: bool = ...,
packetsize: int | None = ...,
userkey: str | None = ...,
*,
sessionvariables: dict[str, str] | None = ...,
forcebulkfetch: bool | None = ...,
) -> None: ...
def cancel(self) -> bool: ...
def close(self) -> None: ...
def commit(self) -> None: ...
def cursor(self) -> Cursor: ...
def getaddress(self) -> str: ...
def getautocommit(self) -> bool: ...
def getclientinfo(self, key: str = ...) -> str | dict[str, str]: ...
def isconnected(self) -> bool: ...
def rollback(self) -> None: ...
def setautocommit(self, auto: bool = ...) -> None: ...
def setclientinfo(self, key: str, value: str | None = ...) -> None: ...
class LOB:
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def close(self) -> bool: ...
def find(self, object: str, length: int, position: int = ...) -> int: ...
def read(self, size: int = ..., position: int = ...) -> str | bytes: ...
def write(self, object: str | bytes) -> int: ...
_Parameters = Sequence[Tuple[Any, ...]]
class Cursor:
description: Tuple[Tuple[Any, ...], ...]
rowcount: int
statementhash: str | None
connection: Connection
arraysize: int
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def callproc(self, procname: str, parameters: Tuple[Any, ...] = ..., overview: bool = ...) -> Tuple[Any, ...]: ...
def close(self) -> None: ...
def description_ext(self) -> Sequence[Tuple[Any, ...]]: ...
def execute(self, operation: str, parameters: Tuple[Any, ...]) -> bool: ...
def executemany(self, operation: str, parameters: _Parameters) -> Any: ...
def executemanyprepared(self, parameters: _Parameters) -> Any: ...
def executeprepared(self, parameters: _Parameters = ...) -> Any: ...
def fetchone(self, uselob: bool = ...) -> ResultRow | None: ...
def fetchall(self) -> list[ResultRow]: ...
def fetchmany(self, size: int | None = ...) -> list[ResultRow]: ...
def get_resultset_holdability(self) -> int: ...
def getwarning(self) -> Warning | None: ...
def haswarning(self) -> bool: ...
def nextset(self) -> None: ...
def parameter_description(self) -> Tuple[str, ...]: ...
@overload
def prepare(self, operation: str, newcursor: Literal[True]) -> Cursor: ...
@overload
def prepare(self, operation: str, newcursor: Literal[False]) -> Any: ...
def scroll(self, value: int, mode: Literal["absolute"] | Literal["relative"] = ...) -> None: ...
def server_cpu_time(self) -> int: ...
def server_memory_usage(self) -> int: ...
def server_processing_time(self) -> int: ...
def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ...
def setfetchsize(self, value: int) -> None: ...
def set_resultset_holdability(self, holdability: int) -> None: ...
def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ...
class Warning(Exception):
errorcode: int
errortext: str
class Error(Exception):
errorcode: int
errortext: str
class DatabaseError(Error): ...
class OperationalError(DatabaseError): ...
class ProgrammingError(DatabaseError): ...
class IntegrityError(DatabaseError): ...
class InterfaceError(Error): ...
class InternalError(DatabaseError): ...
class DataError(DatabaseError): ...
class NotSupportedError(DatabaseError): ...
def Date(year: int, month: int, day: int) -> date: ...
def Time(hour: int, minute: int, second: int, millisecond: int = ...) -> time: ...
def Timestamp(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int = ...) -> datetime: ...
def DateFromTicks(ticks: float) -> date: ...
def TimeFromTicks(ticks: float) -> time: ...
def TimestampFromTicks(ticks: float) -> datetime: ...
def Binary(data: ReadableBuffer) -> memoryview: ...
Decimal = decimal.Decimal
NUMBER: Type[int] | Type[float] | Type[complex]
DATETIME: Type[date] | Type[time] | Type[datetime]
STRING = str
BINARY = memoryview
ROWID = int

View File

@@ -0,0 +1,6 @@
from typing import Any, Tuple
class ResultRow:
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
column_names: Tuple[str, ...]
column_values: Tuple[Any, ...]