diff --git a/arango/aql.py b/arango/aql.py index 217664e6..4dccef33 100644 --- a/arango/aql.py +++ b/arango/aql.py @@ -36,7 +36,7 @@ from arango.request import Request from arango.response import Response from arango.result import Result -from arango.typings import Json, Jsons +from arango.typings import DataTypes, Json, Jsons class AQLQueryCache(ApiGroup): @@ -173,7 +173,7 @@ def explain( all_plans: bool = False, max_plans: Optional[int] = None, opt_rules: Optional[Sequence[str]] = None, - bind_vars: Optional[MutableMapping[str, str]] = None, + bind_vars: Optional[MutableMapping[str, DataTypes]] = None, ) -> Result[Union[Json, Jsons]]: """Inspect the query and return its metadata without executing it. @@ -257,7 +257,7 @@ def execute( count: bool = False, batch_size: Optional[int] = None, ttl: Optional[Number] = None, - bind_vars: Optional[MutableMapping[str, str]] = None, + bind_vars: Optional[MutableMapping[str, DataTypes]] = None, full_count: Optional[bool] = None, max_plans: Optional[int] = None, optimizer_rules: Optional[Sequence[str]] = None, diff --git a/arango/typings.py b/arango/typings.py index 8d49e3fd..157802f9 100644 --- a/arango/typings.py +++ b/arango/typings.py @@ -1,6 +1,16 @@ -__all__ = ["Fields", "Headers", "Json", "Jsons", "Params"] +__all__ = [ + "Fields", + "Headers", + "Json", + "Jsons", + "Params", + "PrimitiveDataTypes", + "CompoundDataTypes", + "DataTypes", +] -from typing import Any, Dict, List, MutableMapping, Sequence, Union +from numbers import Number +from typing import Any, Dict, List, MutableMapping, Optional, Sequence, Union Json = Dict[str, Any] Jsons = List[Json] @@ -8,3 +18,11 @@ Headers = MutableMapping[str, str] Fields = Union[str, Sequence[str]] DriverFlags = List[str] +PrimitiveDataTypes = Optional[Union[bool, Number, str]] +CompoundDataTypes = Optional[ + Union[ + Sequence[Optional[Union[PrimitiveDataTypes, "CompoundDataTypes"]]], + MutableMapping[str, Optional[Union[PrimitiveDataTypes, "CompoundDataTypes"]]], + ] +] +DataTypes = Optional[Union[PrimitiveDataTypes, CompoundDataTypes]]