Skip to content

Commit 9776c1e

Browse files
fix: Added all allowed data types to the bind_vars. (#289)
Co-authored-by: ValentG2 <[email protected]>
1 parent 0729f20 commit 9776c1e

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

arango/aql.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from arango.request import Request
3737
from arango.response import Response
3838
from arango.result import Result
39-
from arango.typings import Json, Jsons
39+
from arango.typings import DataTypes, Json, Jsons
4040

4141

4242
class AQLQueryCache(ApiGroup):
@@ -173,7 +173,7 @@ def explain(
173173
all_plans: bool = False,
174174
max_plans: Optional[int] = None,
175175
opt_rules: Optional[Sequence[str]] = None,
176-
bind_vars: Optional[MutableMapping[str, str]] = None,
176+
bind_vars: Optional[MutableMapping[str, DataTypes]] = None,
177177
) -> Result[Union[Json, Jsons]]:
178178
"""Inspect the query and return its metadata without executing it.
179179
@@ -257,7 +257,7 @@ def execute(
257257
count: bool = False,
258258
batch_size: Optional[int] = None,
259259
ttl: Optional[Number] = None,
260-
bind_vars: Optional[MutableMapping[str, str]] = None,
260+
bind_vars: Optional[MutableMapping[str, DataTypes]] = None,
261261
full_count: Optional[bool] = None,
262262
max_plans: Optional[int] = None,
263263
optimizer_rules: Optional[Sequence[str]] = None,

arango/typings.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
__all__ = ["Fields", "Headers", "Json", "Jsons", "Params"]
1+
__all__ = [
2+
"Fields",
3+
"Headers",
4+
"Json",
5+
"Jsons",
6+
"Params",
7+
"PrimitiveDataTypes",
8+
"CompoundDataTypes",
9+
"DataTypes",
10+
]
211

3-
from typing import Any, Dict, List, MutableMapping, Sequence, Union
12+
from numbers import Number
13+
from typing import Any, Dict, List, MutableMapping, Optional, Sequence, Union
414

515
Json = Dict[str, Any]
616
Jsons = List[Json]
717
Params = MutableMapping[str, Union[bool, int, str]]
818
Headers = MutableMapping[str, str]
919
Fields = Union[str, Sequence[str]]
1020
DriverFlags = List[str]
21+
PrimitiveDataTypes = Optional[Union[bool, Number, str]]
22+
CompoundDataTypes = Optional[
23+
Union[
24+
Sequence[Optional[Union[PrimitiveDataTypes, "CompoundDataTypes"]]],
25+
MutableMapping[str, Optional[Union[PrimitiveDataTypes, "CompoundDataTypes"]]],
26+
]
27+
]
28+
DataTypes = Optional[Union[PrimitiveDataTypes, CompoundDataTypes]]

0 commit comments

Comments
 (0)