Skip to content

Commit

Permalink
fix: Added all allowed data types to the bind_vars.
Browse files Browse the repository at this point in the history
  • Loading branch information
valentingregoirebasf committed Sep 20, 2023
1 parent 0729f20 commit 35bab26
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
6 changes: 3 additions & 3 deletions arango/aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 20 additions & 2 deletions arango/typings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
__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]
Params = MutableMapping[str, Union[bool, int, str]]
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]]

0 comments on commit 35bab26

Please sign in to comment.