Skip to content

Commit 2690421

Browse files
committed
Merge branch 'main' into support-overload-control
2 parents f731023 + 0c0adb9 commit 2690421

27 files changed

+320
-75
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ on:
1313

1414
jobs:
1515
build:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717

1818
strategy:
1919
matrix:
20-
python-version: ["3.8", "3.9", "3.10", "3.11.1"]
20+
python-version: ["3.8", "3.9", "3.10", "3.11"]
2121

2222
steps:
2323
- name: Checkout repository
@@ -28,14 +28,8 @@ jobs:
2828

2929
- name: Create ArangoDB Docker container
3030
run: >
31-
docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd
32-
arangodb/arangodb:3.7.7 --server.jwt-secret-keyfile=/tmp/keyfile
33-
34-
- name: Copy Foxx service zip into ArangoDB Docker container
35-
run: docker cp tests/static/service.zip arango:/tmp/service.zip
36-
37-
- name: Copy keyfile into ArangoDB Docker container
38-
run: docker cp tests/static/keyfile arango:/tmp/keyfile
31+
docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd -v "$(pwd)/tests/static/":/tests/static
32+
arangodb/arangodb:3.10.6 --server.jwt-secret-keyfile=/tests/static/keyfile
3933
4034
- name: Start ArangoDB Docker container
4135
run: docker start arango

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,6 @@ node_modules/
121121

122122
# setuptools_scm
123123
arango/version.py
124+
125+
# test results
126+
*_results.txt

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
main
2+
----
3+
4+
* Adding peak_memory_usage as a new property of AQL queries, available since ArangoDB 3.11.
5+
6+
* The explain method of AQL queries includes the "stats" field in the returned object. Note that the REST API returns
7+
it separately from the "plan" field, but for now we have to merge them together to ensure backward compatibility.

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Run unit tests with coverage:
1313
py.test --cov=arango --cov-report=html # Open htmlcov/index.html in your browser
1414
```
1515

16+
For a more comprehensive test suite, run:
17+
18+
```shell
19+
./tester.sh # Requires docker
20+
```
21+
1622
Build and test documentation:
1723

1824
```shell

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ db = client.db("test", username="root", password="passwd")
7272
# Create a new graph named "school".
7373
graph = db.create_graph("school")
7474

75+
# Create a new EnterpriseGraph [Enterprise Edition]
76+
eegraph = db.create_graph(
77+
name="school",
78+
smart=True)
79+
7580
# Create vertex collections for the graph.
7681
students = graph.create_vertex_collection("students")
7782
lectures = graph.create_vertex_collection("lectures")

arango/aql.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,19 @@ def response_handler(resp: Response) -> Union[Json, Jsons]:
213213
if not resp.is_success:
214214
raise AQLQueryExplainError(resp, request)
215215
if "plan" in resp.body:
216-
plan: Json = resp.body["plan"]
217-
return plan
216+
result: Json = resp.body["plan"]
217+
if "stats" in resp.body:
218+
result["stats"] = resp.body["stats"]
219+
return result
218220
else:
219-
plans: Jsons = resp.body["plans"]
220-
return plans
221+
results: Jsons = resp.body["plans"]
222+
if "stats" in resp.body:
223+
# Although "plans" contains an array, "stats" is a single object.
224+
# We need to duplicate "stats" for each plan in order to preserve
225+
# the original structure.
226+
for plan in results:
227+
plan["stats"] = resp.body["stats"]
228+
return results
221229

222230
return self._execute(request, response_handler)
223231

arango/backup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get(self, backup_id: Optional[str] = None) -> Result[Json]:
3838
request = Request(
3939
method="post",
4040
endpoint="/_admin/backup/list",
41-
data={} if backup_id is None else {"id": backup_id},
41+
data=None if backup_id is None else {"id": backup_id},
4242
)
4343

4444
def response_handler(resp: Response) -> Json:

arango/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from json import dumps, loads
44
from typing import Any, Callable, Optional, Sequence, Union
55

6-
from pkg_resources import get_distribution
6+
import importlib_metadata
77

88
from arango.connection import (
99
BasicConnection,
@@ -127,7 +127,7 @@ def version(self) -> str:
127127
:return: Client version.
128128
:rtype: str
129129
"""
130-
version: str = get_distribution("python-arango").version
130+
version: str = importlib_metadata.version("python-arango")
131131
return version
132132

133133
@property

arango/collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ def find_in_box(
863863
limit: Optional[int] = None,
864864
index: Optional[str] = None,
865865
) -> Result[Cursor]:
866-
"""Return all documents in an rectangular area.
866+
"""Return all documents in a rectangular area.
867867
868868
:param latitude1: First latitude.
869869
:type latitude1: int | float

arango/formatter.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def format_index(body: Json) -> Json:
6565
result["cacheEnabled"] = body["cacheEnabled"]
6666
if "legacyPolygons" in body:
6767
result["legacyPolygons"] = body["legacyPolygons"]
68+
if "estimates" in body:
69+
result["estimates"] = body["estimates"]
6870

6971
return verify_format(body, result)
7072

@@ -227,6 +229,8 @@ def format_collection(body: Json) -> Json:
227229
}
228230
for cv in body["computedValues"]
229231
]
232+
if "internalValidatorType" in body:
233+
result["internal_validator_type"] = body["internalValidatorType"]
230234

231235
return verify_format(body, result)
232236

@@ -318,6 +322,10 @@ def format_aql_query(body: Json) -> Json:
318322
result["stream"] = body["stream"]
319323
if "user" in body:
320324
result["user"] = body["user"]
325+
326+
# New in 3.11
327+
if "peakMemoryUsage" in body:
328+
result["peak_memory_usage"] = body["peakMemoryUsage"]
321329
return verify_format(body, result)
322330

323331

@@ -393,6 +401,10 @@ def format_server_status(body: Json) -> Json:
393401
"""
394402
result: Json = {}
395403

404+
if "agency" in body:
405+
result["agency"] = body["agency"]
406+
if "coordinator" in body:
407+
result["coordinator"] = body["coordinator"]
396408
if "foxxApi" in body:
397409
result["foxx_api"] = body["foxxApi"]
398410
if "host" in body:
@@ -985,6 +997,9 @@ def format_backup(body: Json) -> Json:
985997
if "nrPiecesPresent" in body:
986998
result["pieces_present"] = body["nrPiecesPresent"]
987999

1000+
if "countIncludesFilesOnly" in body:
1001+
result["count_includes_files_only"] = body["countIncludesFilesOnly"]
1002+
9881003
return verify_format(body, result)
9891004

9901005

@@ -1135,6 +1150,14 @@ def format_pregel_job_data(body: Json) -> Json:
11351150
# The detail element was introduced in 3.10
11361151
if "detail" in body:
11371152
result["detail"] = body["detail"]
1153+
if "database" in body:
1154+
result["database"] = body["database"]
1155+
if "masterContext" in body:
1156+
result["master_context"] = body["masterContext"]
1157+
if "parallelism" in body:
1158+
result["parallelism"] = body["parallelism"]
1159+
if "useMemoryMaps" in body:
1160+
result["use_memory_maps"] = body["useMemoryMaps"]
11381161

11391162
return verify_format(body, result)
11401163

@@ -1177,12 +1200,18 @@ def format_graph_properties(body: Json) -> Json:
11771200
}
11781201
if "isSmart" in body:
11791202
result["smart"] = body["isSmart"]
1203+
if "isSatellite" in body:
1204+
result["is_satellite"] = body["isSatellite"]
11801205
if "smartGraphAttribute" in body:
11811206
result["smart_field"] = body["smartGraphAttribute"]
11821207
if "numberOfShards" in body:
11831208
result["shard_count"] = body["numberOfShards"]
11841209
if "replicationFactor" in body:
11851210
result["replication_factor"] = body["replicationFactor"]
1211+
if "minReplicationFactor" in body:
1212+
result["min_replication_factor"] = body["minReplicationFactor"]
1213+
if "writeConcern" in body:
1214+
result["write_concern"] = body["writeConcern"]
11861215

11871216
return verify_format(body, result)
11881217

0 commit comments

Comments
 (0)