python-arango 7.9.1__tar.gz → 8.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-arango-7.9.1 → python_arango-8.1.0}/.circleci/config.yml +1 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/.github/workflows/docs.yaml +3 -2
- {python-arango-7.9.1 → python_arango-8.1.0}/.readthedocs.yaml +1 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/PKG-INFO +19 -19
- {python-arango-7.9.1 → python_arango-8.1.0}/README.md +16 -15
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/client.py +28 -7
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/cluster.py +74 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/collection.py +119 -27
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/connection.py +49 -4
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/database.py +334 -10
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/exceptions.py +51 -3
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/executor.py +31 -11
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/formatter.py +15 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/graph.py +9 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/http.py +84 -5
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/replication.py +9 -7
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/request.py +1 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/admin.rst +17 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/cluster.rst +6 -1
- python_arango-8.1.0/docs/compression.rst +40 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/conf.py +4 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/contributing.rst +9 -11
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/graph.rst +12 -11
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/index.rst +46 -13
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/indexes.rst +20 -10
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/overview.rst +2 -2
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/pregel.rst +5 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/simple.rst +0 -2
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/specs.rst +6 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/transaction.rst +10 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/pyproject.toml +2 -3
- {python-arango-7.9.1 → python_arango-8.1.0}/python_arango.egg-info/PKG-INFO +19 -19
- {python-arango-7.9.1 → python_arango-8.1.0}/python_arango.egg-info/SOURCES.txt +1 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/python_arango.egg-info/requires.txt +0 -1
- {python-arango-7.9.1 → python_arango-8.1.0}/starter.sh +6 -5
- {python-arango-7.9.1 → python_arango-8.1.0}/.github/workflows/codeql.yaml +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/.github/workflows/pypi.yaml +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/.gitignore +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/.pre-commit-config.yaml +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/CONTRIBUTING.md +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/LICENSE +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/MANIFEST.in +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/__init__.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/api.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/aql.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/backup.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/cursor.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/errno.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/foxx.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/job.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/pregel.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/py.typed +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/resolver.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/response.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/result.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/typings.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/utils.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/arango/wal.py +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/Makefile +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/analyzer.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/aql.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/async.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/auth.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/backup.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/batch.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/certificates.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/collection.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/cursor.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/database.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/document.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/errno.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/errors.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/foxx.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/http.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/logging.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/make.bat +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/overload.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/replication.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/requirements.txt +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/schema.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/serializer.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/static/logo.png +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/task.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/threading.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/user.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/view.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/docs/wal.rst +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/python_arango.egg-info/dependency_links.txt +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/python_arango.egg-info/top_level.txt +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/setup.cfg +0 -0
- {python-arango-7.9.1 → python_arango-8.1.0}/setup.py +0 -0
|
@@ -15,7 +15,7 @@ workflows:
|
|
|
15
15
|
python_version: ["3.8", "3.9", "3.10", "3.11"] # "3.12"
|
|
16
16
|
arangodb_config: ["single", "cluster"]
|
|
17
17
|
arangodb_license: ["community", "enterprise"]
|
|
18
|
-
arangodb_version: ["3.
|
|
18
|
+
arangodb_version: ["3.11", "latest"]
|
|
19
19
|
|
|
20
20
|
jobs:
|
|
21
21
|
lint:
|
|
@@ -98,5 +98,6 @@ jobs:
|
|
|
98
98
|
- name: Run Sphinx doctest
|
|
99
99
|
run: python -m sphinx -b doctest docs docs/_build
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
# No longer needed as this is handled by Read the Docs
|
|
102
|
+
#- name: Generate Sphinx HTML
|
|
103
|
+
# run: python -m sphinx -b html -W docs docs/_build
|
|
@@ -15,6 +15,7 @@ sphinx:
|
|
|
15
15
|
configuration: docs/conf.py
|
|
16
16
|
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
|
|
17
17
|
# builder: "dirhtml"
|
|
18
|
+
builder: html
|
|
18
19
|
# Fail on all warnings to avoid broken references
|
|
19
20
|
fail_on_warning: true
|
|
20
21
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-arango
|
|
3
|
-
Version:
|
|
3
|
+
Version: 8.1.0
|
|
4
4
|
Summary: Python Driver for ArangoDB
|
|
5
5
|
Author-email: Joohwan Oh <joohwan.oh@outlook.com>
|
|
6
|
-
Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <
|
|
6
|
+
Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
|
|
7
7
|
License: MIT License
|
|
8
8
|
|
|
9
9
|
Copyright (c) 2016-2021 Joohwan Oh
|
|
@@ -26,7 +26,7 @@ License: MIT License
|
|
|
26
26
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
27
|
SOFTWARE.
|
|
28
28
|
|
|
29
|
-
Project-URL: homepage, https://github.com/
|
|
29
|
+
Project-URL: homepage, https://github.com/arangodb/python-arango
|
|
30
30
|
Keywords: arangodb,python,driver
|
|
31
31
|
Classifier: Intended Audience :: Developers
|
|
32
32
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -61,22 +61,21 @@ Requires-Dist: pytest>=7.1.1; extra == "dev"
|
|
|
61
61
|
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
|
|
62
62
|
Requires-Dist: sphinx; extra == "dev"
|
|
63
63
|
Requires-Dist: sphinx_rtd_theme; extra == "dev"
|
|
64
|
-
Requires-Dist: types-pkg_resources; extra == "dev"
|
|
65
64
|
Requires-Dist: types-requests; extra == "dev"
|
|
66
65
|
Requires-Dist: types-setuptools; extra == "dev"
|
|
67
66
|
|
|
68
67
|

|
|
69
68
|
|
|
70
|
-
[](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango/tree/main)
|
|
70
|
+
[](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml)
|
|
71
|
+
[](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml)
|
|
72
|
+
[](https://codecov.io/gh/arangodb/python-arango)
|
|
73
|
+
[](https://github.com/arangodb/python-arango/commits/master)
|
|
75
74
|
|
|
76
75
|
[](https://pypi.org/project/python-arango/)
|
|
77
76
|
[](https://pypi.org/project/python-arango/)
|
|
78
77
|
|
|
79
|
-
[](https://github.com/arangodb/python-arango/blob/master/LICENSE)
|
|
80
79
|
[](https://github.com/psf/black)
|
|
81
80
|
[](https://pepy.tech/project/python-arango)
|
|
@@ -88,7 +87,7 @@ database natively supporting documents, graphs and search.
|
|
|
88
87
|
|
|
89
88
|
## Requirements
|
|
90
89
|
|
|
91
|
-
- ArangoDB version 3.
|
|
90
|
+
- ArangoDB version 3.11+
|
|
92
91
|
- Python version 3.8+
|
|
93
92
|
|
|
94
93
|
## Installation
|
|
@@ -119,8 +118,8 @@ db = client.db("test", username="root", password="passwd")
|
|
|
119
118
|
# Create a new collection named "students".
|
|
120
119
|
students = db.create_collection("students")
|
|
121
120
|
|
|
122
|
-
# Add a
|
|
123
|
-
students.
|
|
121
|
+
# Add a persistent index to the collection.
|
|
122
|
+
students.add_index({'type': 'persistent', 'fields': ['name'], 'unique': True})
|
|
124
123
|
|
|
125
124
|
# Insert new documents into the collection.
|
|
126
125
|
students.insert({"name": "jane", "age": 39})
|
|
@@ -180,12 +179,13 @@ edges.insert({"_from": "students/02", "_to": "lectures/MAT101"})
|
|
|
180
179
|
edges.insert({"_from": "students/02", "_to": "lectures/STA101"})
|
|
181
180
|
edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
|
|
182
181
|
|
|
183
|
-
# Traverse the graph in outbound direction,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
# Traverse the graph in outbound direction, breath-first.
|
|
183
|
+
query = """
|
|
184
|
+
FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
|
|
185
|
+
OPTIONS { bfs: true, uniqueVertices: 'global' }
|
|
186
|
+
RETURN {vertex: v, edge: e, path: p}
|
|
187
|
+
"""
|
|
188
|
+
cursor = db.aql.execute(query)
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
Please see the [documentation](https://docs.python-arango.com) for more details.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
[](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango/tree/main)
|
|
4
|
+
[](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml)
|
|
5
|
+
[](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml)
|
|
6
|
+
[](https://codecov.io/gh/arangodb/python-arango)
|
|
7
|
+
[](https://github.com/arangodb/python-arango/commits/master)
|
|
8
8
|
|
|
9
9
|
[](https://pypi.org/project/python-arango/)
|
|
10
10
|
[](https://pypi.org/project/python-arango/)
|
|
11
11
|
|
|
12
|
-
[](https://github.com/arangodb/python-arango/blob/master/LICENSE)
|
|
13
13
|
[](https://github.com/psf/black)
|
|
14
14
|
[](https://pepy.tech/project/python-arango)
|
|
@@ -21,7 +21,7 @@ database natively supporting documents, graphs and search.
|
|
|
21
21
|
|
|
22
22
|
## Requirements
|
|
23
23
|
|
|
24
|
-
- ArangoDB version 3.
|
|
24
|
+
- ArangoDB version 3.11+
|
|
25
25
|
- Python version 3.8+
|
|
26
26
|
|
|
27
27
|
## Installation
|
|
@@ -52,8 +52,8 @@ db = client.db("test", username="root", password="passwd")
|
|
|
52
52
|
# Create a new collection named "students".
|
|
53
53
|
students = db.create_collection("students")
|
|
54
54
|
|
|
55
|
-
# Add a
|
|
56
|
-
students.
|
|
55
|
+
# Add a persistent index to the collection.
|
|
56
|
+
students.add_index({'type': 'persistent', 'fields': ['name'], 'unique': True})
|
|
57
57
|
|
|
58
58
|
# Insert new documents into the collection.
|
|
59
59
|
students.insert({"name": "jane", "age": 39})
|
|
@@ -113,12 +113,13 @@ edges.insert({"_from": "students/02", "_to": "lectures/MAT101"})
|
|
|
113
113
|
edges.insert({"_from": "students/02", "_to": "lectures/STA101"})
|
|
114
114
|
edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
|
|
115
115
|
|
|
116
|
-
# Traverse the graph in outbound direction,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
# Traverse the graph in outbound direction, breath-first.
|
|
117
|
+
query = """
|
|
118
|
+
FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
|
|
119
|
+
OPTIONS { bfs: true, uniqueVertices: 'global' }
|
|
120
|
+
RETURN {vertex: v, edge: e, path: p}
|
|
121
|
+
"""
|
|
122
|
+
cursor = db.aql.execute(query)
|
|
122
123
|
```
|
|
123
124
|
|
|
124
125
|
Please see the [documentation](https://docs.python-arango.com) for more details.
|
|
@@ -12,8 +12,13 @@ from arango.connection import (
|
|
|
12
12
|
JwtSuperuserConnection,
|
|
13
13
|
)
|
|
14
14
|
from arango.database import StandardDatabase
|
|
15
|
-
from arango.exceptions import ServerConnectionError
|
|
16
|
-
from arango.http import
|
|
15
|
+
from arango.exceptions import ArangoClientError, ServerConnectionError
|
|
16
|
+
from arango.http import (
|
|
17
|
+
DEFAULT_REQUEST_TIMEOUT,
|
|
18
|
+
DefaultHTTPClient,
|
|
19
|
+
HTTPClient,
|
|
20
|
+
RequestCompression,
|
|
21
|
+
)
|
|
17
22
|
from arango.resolver import (
|
|
18
23
|
FallbackHostResolver,
|
|
19
24
|
HostResolver,
|
|
@@ -33,7 +38,7 @@ def default_serializer(x: Any) -> str:
|
|
|
33
38
|
:return: The object serialized as a JSON string
|
|
34
39
|
:rtype: str
|
|
35
40
|
"""
|
|
36
|
-
return dumps(x)
|
|
41
|
+
return dumps(x, separators=(",", ":"))
|
|
37
42
|
|
|
38
43
|
|
|
39
44
|
def default_deserializer(x: str) -> Any:
|
|
@@ -85,6 +90,12 @@ class ArangoClient:
|
|
|
85
90
|
None: No timeout.
|
|
86
91
|
int: Timeout value in seconds.
|
|
87
92
|
:type request_timeout: int | float
|
|
93
|
+
:param request_compression: Will compress requests to the server according to
|
|
94
|
+
the given algorithm. No compression happens by default.
|
|
95
|
+
:type request_compression: arango.http.RequestCompression | None
|
|
96
|
+
:param response_compression: Tells the server what compression algorithm is
|
|
97
|
+
acceptable for the response. No compression happens by default.
|
|
98
|
+
:type response_compression: str | None
|
|
88
99
|
"""
|
|
89
100
|
|
|
90
101
|
def __init__(
|
|
@@ -97,6 +108,8 @@ class ArangoClient:
|
|
|
97
108
|
deserializer: Callable[[str], Any] = default_deserializer,
|
|
98
109
|
verify_override: Union[bool, str, None] = None,
|
|
99
110
|
request_timeout: Union[int, float, None] = DEFAULT_REQUEST_TIMEOUT,
|
|
111
|
+
request_compression: Optional[RequestCompression] = None,
|
|
112
|
+
response_compression: Optional[str] = None,
|
|
100
113
|
) -> None:
|
|
101
114
|
if isinstance(hosts, str):
|
|
102
115
|
self._hosts = [host.strip("/") for host in hosts.split(",")]
|
|
@@ -133,6 +146,9 @@ class ArangoClient:
|
|
|
133
146
|
for session in self._sessions:
|
|
134
147
|
session.verify = verify_override
|
|
135
148
|
|
|
149
|
+
self._request_compression = request_compression
|
|
150
|
+
self._response_compression = response_compression
|
|
151
|
+
|
|
136
152
|
def __repr__(self) -> str:
|
|
137
153
|
return f"<ArangoClient {','.join(self._hosts)}>"
|
|
138
154
|
|
|
@@ -183,7 +199,6 @@ class ArangoClient:
|
|
|
183
199
|
auth_method: str = "basic",
|
|
184
200
|
user_token: Optional[str] = None,
|
|
185
201
|
superuser_token: Optional[str] = None,
|
|
186
|
-
verify_certificate: bool = True,
|
|
187
202
|
) -> StandardDatabase:
|
|
188
203
|
"""Connect to an ArangoDB database and return the database API wrapper.
|
|
189
204
|
|
|
@@ -212,8 +227,6 @@ class ArangoClient:
|
|
|
212
227
|
are ignored. This token is not refreshed automatically. Token
|
|
213
228
|
expiry will not be checked.
|
|
214
229
|
:type superuser_token: str
|
|
215
|
-
:param verify_certificate: Verify TLS certificates.
|
|
216
|
-
:type verify_certificate: bool
|
|
217
230
|
:return: Standard database API wrapper.
|
|
218
231
|
:rtype: arango.database.StandardDatabase
|
|
219
232
|
:raise arango.exceptions.ServerConnectionError: If **verify** was set
|
|
@@ -231,6 +244,8 @@ class ArangoClient:
|
|
|
231
244
|
serializer=self._serializer,
|
|
232
245
|
deserializer=self._deserializer,
|
|
233
246
|
superuser_token=superuser_token,
|
|
247
|
+
request_compression=self._request_compression,
|
|
248
|
+
response_compression=self._response_compression,
|
|
234
249
|
)
|
|
235
250
|
elif user_token is not None:
|
|
236
251
|
connection = JwtConnection(
|
|
@@ -242,6 +257,8 @@ class ArangoClient:
|
|
|
242
257
|
serializer=self._serializer,
|
|
243
258
|
deserializer=self._deserializer,
|
|
244
259
|
user_token=user_token,
|
|
260
|
+
request_compression=self._request_compression,
|
|
261
|
+
response_compression=self._response_compression,
|
|
245
262
|
)
|
|
246
263
|
elif auth_method.lower() == "basic":
|
|
247
264
|
connection = BasicConnection(
|
|
@@ -254,6 +271,8 @@ class ArangoClient:
|
|
|
254
271
|
http_client=self._http,
|
|
255
272
|
serializer=self._serializer,
|
|
256
273
|
deserializer=self._deserializer,
|
|
274
|
+
request_compression=self._request_compression,
|
|
275
|
+
response_compression=self._response_compression,
|
|
257
276
|
)
|
|
258
277
|
elif auth_method.lower() == "jwt":
|
|
259
278
|
connection = JwtConnection(
|
|
@@ -266,6 +285,8 @@ class ArangoClient:
|
|
|
266
285
|
http_client=self._http,
|
|
267
286
|
serializer=self._serializer,
|
|
268
287
|
deserializer=self._deserializer,
|
|
288
|
+
request_compression=self._request_compression,
|
|
289
|
+
response_compression=self._response_compression,
|
|
269
290
|
)
|
|
270
291
|
else:
|
|
271
292
|
raise ValueError(f"invalid auth_method: {auth_method}")
|
|
@@ -276,6 +297,6 @@ class ArangoClient:
|
|
|
276
297
|
except ServerConnectionError as err:
|
|
277
298
|
raise err
|
|
278
299
|
except Exception as err:
|
|
279
|
-
raise
|
|
300
|
+
raise ArangoClientError(f"bad connection: {err}")
|
|
280
301
|
|
|
281
302
|
return StandardDatabase(connection)
|
|
@@ -11,6 +11,7 @@ from arango.exceptions import (
|
|
|
11
11
|
ClusterServerCountError,
|
|
12
12
|
ClusterServerEngineError,
|
|
13
13
|
ClusterServerIDError,
|
|
14
|
+
ClusterServerModeError,
|
|
14
15
|
ClusterServerRoleError,
|
|
15
16
|
ClusterServerStatisticsError,
|
|
16
17
|
ClusterServerVersionError,
|
|
@@ -57,6 +58,27 @@ class Cluster(ApiGroup): # pragma: no cover
|
|
|
57
58
|
|
|
58
59
|
return self._execute(request, response_handler)
|
|
59
60
|
|
|
61
|
+
def server_mode(self) -> Result[str]:
|
|
62
|
+
"""Return the server mode.
|
|
63
|
+
|
|
64
|
+
In a read-only server, all write operations will fail
|
|
65
|
+
with an error code of 1004 (ERROR_READ_ONLY). Creating or dropping
|
|
66
|
+
databases and collections will also fail with error code 11 (ERROR_FORBIDDEN).
|
|
67
|
+
|
|
68
|
+
:return: Server mode. Possible values are "default" or "readonly".
|
|
69
|
+
:rtype: str
|
|
70
|
+
:raise arango.exceptions.ClusterServerModeError: If retrieval fails.
|
|
71
|
+
"""
|
|
72
|
+
request = Request(method="get", endpoint="/_admin/server/mode")
|
|
73
|
+
|
|
74
|
+
def response_handler(resp: Response) -> str:
|
|
75
|
+
if resp.is_success:
|
|
76
|
+
return str(resp.body["mode"])
|
|
77
|
+
|
|
78
|
+
raise ClusterServerModeError(resp, request)
|
|
79
|
+
|
|
80
|
+
return self._execute(request, response_handler)
|
|
81
|
+
|
|
60
82
|
def server_version(self, server_id: str) -> Result[Json]:
|
|
61
83
|
"""Return the version of the given server.
|
|
62
84
|
|
|
@@ -140,6 +162,58 @@ class Cluster(ApiGroup): # pragma: no cover
|
|
|
140
162
|
|
|
141
163
|
return self._execute(request, response_handler)
|
|
142
164
|
|
|
165
|
+
def server_maintenance_mode(self, server_id: str) -> Result[Json]:
|
|
166
|
+
"""Return the maintenance status for the given server.
|
|
167
|
+
|
|
168
|
+
:param server_id: Server ID.
|
|
169
|
+
:type server_id: str
|
|
170
|
+
:return: Maintenance status for the given server.
|
|
171
|
+
:rtype: dict
|
|
172
|
+
:raise arango.exceptions.ClusterMaintenanceModeError: If retrieval fails.
|
|
173
|
+
"""
|
|
174
|
+
request = Request(
|
|
175
|
+
method="get",
|
|
176
|
+
endpoint=f"/_admin/cluster/maintenance/{server_id}",
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def response_handler(resp: Response) -> Json:
|
|
180
|
+
if resp.is_success:
|
|
181
|
+
result: Json = resp.body.get("result", {})
|
|
182
|
+
return result
|
|
183
|
+
|
|
184
|
+
raise ClusterMaintenanceModeError(resp, request)
|
|
185
|
+
|
|
186
|
+
return self._execute(request, response_handler)
|
|
187
|
+
|
|
188
|
+
def toggle_server_maintenance_mode(
|
|
189
|
+
self, server_id: str, mode: str, timeout: Optional[int] = None
|
|
190
|
+
) -> Result[Json]:
|
|
191
|
+
"""Enable or disable the maintenance mode for the given server.
|
|
192
|
+
|
|
193
|
+
:param server_id: Server ID.
|
|
194
|
+
:type server_id: str
|
|
195
|
+
:param mode: Maintenance mode. Allowed values are "normal" and "maintenance".
|
|
196
|
+
:type mode: str
|
|
197
|
+
:param timeout: Timeout in seconds.
|
|
198
|
+
:type timeout: Optional[int]
|
|
199
|
+
:return: Result of the operation.
|
|
200
|
+
:rtype: dict
|
|
201
|
+
:raise arango.exceptions.ClusterMaintenanceModeError: If toggle fails.
|
|
202
|
+
"""
|
|
203
|
+
request = Request(
|
|
204
|
+
method="put",
|
|
205
|
+
endpoint=f"/_admin/cluster/maintenance/{server_id}",
|
|
206
|
+
data={"mode": mode, "timeout": timeout},
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def response_handler(resp: Response) -> Json:
|
|
210
|
+
if resp.is_success:
|
|
211
|
+
return format_body(resp.body)
|
|
212
|
+
|
|
213
|
+
raise ClusterMaintenanceModeError(resp, request)
|
|
214
|
+
|
|
215
|
+
return self._execute(request, response_handler)
|
|
216
|
+
|
|
143
217
|
def health(self) -> Result[Json]:
|
|
144
218
|
"""Return the cluster health.
|
|
145
219
|
|