from os import PathLike
from types import TracebackType
from collections.abc import ItemsView, Iterator, KeysView, Mapping, ValuesView
from typing import Final, Self, TypeAlias
Parameter: TypeAlias = None | bool | int | float | str | list["Parameter"] | tuple["Parameter", ...] | Mapping[str, "Parameter"]
ResultValue: TypeAlias = None | bool | int | float | str | list["ResultValue"] | dict[str, "ResultValue"] | "Node" | "Relationship" | "Path"
class LittleGraphError(Exception):
code: str
message: str
class InterfaceError(LittleGraphError): ...
class DatabaseClosedError(InterfaceError): ...
class DatabaseWorkerError(InterfaceError): ...
class ForkedProcessError(InterfaceError): ...
class TransactionActiveError(InterfaceError): ...
class TransactionClosedError(InterfaceError): ...
class TransactionAccessedConcurrentlyError(InterfaceError): ...
class DataError(LittleGraphError): ...
class ParameterTypeError(DataError): ...
class ParameterValueError(DataError): ...
class UnsupportedValueError(DataError): ...
class DatabaseError(LittleGraphError): ...
class QueryError(LittleGraphError): ...
class CypherSyntaxError(QueryError): ...
class UnsupportedQueryError(QueryError): ...
class QueryValidationError(QueryError): ...
class QueryExecutionError(QueryError): ...
class ProcedureError(QueryError): ...
class AccessModeError(QueryError): ...
class TransactionError(LittleGraphError): ...
class TransactionRollbackOnlyError(TransactionError): ...
class InvalidSavepointError(TransactionError): ...
class TransactionTimeoutError(TransactionError): ...
class TransactionCancelledError(TransactionError): ...
class TransactionResourceLimitError(TransactionError): ...
class TransactionConflictError(TransactionError): ...
class StoragePoisonedError(TransactionError): ...
class Limits:
def __init__(
self,
*,
max_parameter_depth: int = ...,
max_parameter_items: int = ...,
max_parameter_string_bytes: int = ...,
max_parameter_bytes: int = ...,
max_result_rows: int = ...,
max_result_bytes: int = ...,
worker_command_capacity: int = ...,
signal_poll_interval: float = ...,
default_query_memory_bytes: int = ...,
default_transaction_workspace_bytes: int = ...,
default_transaction_records: int = ...,
default_spill_threshold_bytes: int = ...,
default_max_spill_bytes: int = ...,
default_max_journal_bytes: int = ...,
) -> None: ...
@property
def max_parameter_depth(self) -> int: ...
@property
def max_parameter_items(self) -> int: ...
@property
def max_parameter_string_bytes(self) -> int: ...
@property
def max_parameter_bytes(self) -> int: ...
@property
def max_result_rows(self) -> int: ...
@property
def max_result_bytes(self) -> int: ...
@property
def worker_command_capacity(self) -> int: ...
@property
def signal_poll_interval(self) -> float: ...
@property
def default_query_memory_bytes(self) -> int: ...
@property
def default_transaction_workspace_bytes(self) -> int: ...
@property
def default_transaction_records(self) -> int: ...
@property
def default_spill_threshold_bytes(self) -> int: ...
@property
def default_max_spill_bytes(self) -> int: ...
@property
def default_max_journal_bytes(self) -> int: ...
class Node(Mapping[str, ResultValue]):
@property
def element_id(self) -> str: ...
@property
def record_id(self) -> int | None: ...
@property
def labels(self) -> frozenset[str]: ...
@property
def properties(self) -> Mapping[str, ResultValue]: ...
def __getitem__(self, key: str) -> ResultValue: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[ResultValue]: ...
def items(self) -> ItemsView[str, ResultValue]: ...
def get(self, key: str, default: object = None) -> object: ...
class Relationship(Mapping[str, ResultValue]):
@property
def element_id(self) -> str: ...
@property
def record_id(self) -> int | None: ...
@property
def start_node_element_id(self) -> str: ...
@property
def end_node_element_id(self) -> str: ...
@property
def start_node_record_id(self) -> int | None: ...
@property
def end_node_record_id(self) -> int | None: ...
@property
def type(self) -> str: ...
@property
def properties(self) -> Mapping[str, ResultValue]: ...
def __getitem__(self, key: str) -> ResultValue: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[ResultValue]: ...
def items(self) -> ItemsView[str, ResultValue]: ...
def get(self, key: str, default: object = None) -> object: ...
class Path:
@property
def nodes(self) -> tuple[Node, ...]: ...
@property
def relationships(self) -> tuple[Relationship, ...]: ...
class Record:
def __len__(self) -> int: ...
def __getitem__(self, key: int | str) -> ResultValue: ...
def __iter__(self) -> Iterator[ResultValue]: ...
def keys(self) -> tuple[str, ...]: ...
def values(self) -> tuple[ResultValue, ...]: ...
def items(self) -> tuple[tuple[str, ResultValue], ...]: ...
def data(self) -> dict[str, ResultValue]: ...
class QueryResult:
@property
def columns(self) -> tuple[str, ...]: ...
def __len__(self) -> int: ...
def __getitem__(self, index: int) -> Record: ...
def __iter__(self) -> Iterator[Record]: ...
class Database:
def __init__(
self,
path: str | PathLike[str],
*,
read_only: bool = True,
create: bool = False,
limits: Limits | None = None,
) -> None: ...
@property
def path(self) -> str: ...
@property
def read_only(self) -> bool: ...
@property
def closed(self) -> bool: ...
def close(self) -> None: ...
def execute(
self,
query: str,
parameters: Mapping[str, Parameter] | None = None,
*,
timeout: float | None = None,
) -> QueryResult: ...
def __enter__(self) -> Self: ...
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> bool: ...
def open(
path: str | PathLike[str],
*,
read_only: bool = True,
create: bool = False,
limits: Limits | None = None,
) -> Database: ...
__version__: Final[str]