python-arango 8.1.7__tar.gz → 8.2.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-8.1.7 → python_arango-8.2.0}/PKG-INFO +2 -2
- {python_arango-8.1.7 → python_arango-8.2.0}/README.md +1 -1
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/collection.py +30 -81
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/exceptions.py +4 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/graph.py +102 -77
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/request.py +1 -1
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/graph.rst +2 -1
- {python_arango-8.1.7 → python_arango-8.2.0}/python_arango.egg-info/PKG-INFO +2 -2
- {python_arango-8.1.7 → python_arango-8.2.0}/.circleci/config.yml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/.github/workflows/codeql.yaml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/.github/workflows/docs.yaml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/.github/workflows/pypi.yaml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/.gitignore +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/.pre-commit-config.yaml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/.readthedocs.yaml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/CONTRIBUTING.md +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/LICENSE +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/MANIFEST.in +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/__init__.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/api.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/aql.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/backup.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/client.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/cluster.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/connection.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/cursor.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/database.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/errno.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/executor.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/formatter.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/foxx.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/http.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/job.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/pregel.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/py.typed +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/replication.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/resolver.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/response.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/result.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/typings.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/utils.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/arango/wal.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/Makefile +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/admin.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/analyzer.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/aql.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/async.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/auth.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/backup.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/batch.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/certificates.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/cluster.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/collection.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/compression.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/conf.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/contributing.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/cursor.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/database.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/document.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/errno.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/errors.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/foxx.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/http.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/index.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/indexes.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/logging.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/make.bat +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/overload.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/overview.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/pregel.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/replication.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/requirements.txt +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/schema.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/serializer.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/simple.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/specs.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/static/logo.png +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/task.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/threading.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/transaction.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/user.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/view.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/docs/wal.rst +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/pyproject.toml +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/python_arango.egg-info/SOURCES.txt +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/python_arango.egg-info/dependency_links.txt +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/python_arango.egg-info/requires.txt +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/python_arango.egg-info/top_level.txt +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/setup.cfg +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/setup.py +0 -0
- {python_arango-8.1.7 → python_arango-8.2.0}/starter.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-arango
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.2.0
|
|
4
4
|
Summary: Python Driver for ArangoDB
|
|
5
5
|
Author-email: Joohwan Oh <joohwan.oh@outlook.com>
|
|
6
6
|
Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
|
|
@@ -133,7 +133,7 @@ cursor = db.aql.execute("FOR doc IN students RETURN doc")
|
|
|
133
133
|
student_names = [document["name"] for document in cursor]
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
Another example with [graphs](https://
|
|
136
|
+
Another example with [graphs](https://docs.arangodb.com/stable/graphs/):
|
|
137
137
|
|
|
138
138
|
```python
|
|
139
139
|
from arango import ArangoClient
|
|
@@ -67,7 +67,7 @@ cursor = db.aql.execute("FOR doc IN students RETURN doc")
|
|
|
67
67
|
student_names = [document["name"] for document in cursor]
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Another example with [graphs](https://
|
|
70
|
+
Another example with [graphs](https://docs.arangodb.com/stable/graphs/):
|
|
71
71
|
|
|
72
72
|
```python
|
|
73
73
|
from arango import ArangoClient
|
|
@@ -3008,9 +3008,8 @@ class VertexCollection(Collection):
|
|
|
3008
3008
|
self,
|
|
3009
3009
|
vertex: Json,
|
|
3010
3010
|
sync: Optional[bool] = None,
|
|
3011
|
-
silent: bool = False,
|
|
3012
3011
|
return_new: bool = False,
|
|
3013
|
-
) -> Result[
|
|
3012
|
+
) -> Result[Json]:
|
|
3014
3013
|
"""Insert a new vertex document.
|
|
3015
3014
|
|
|
3016
3015
|
:param vertex: New vertex document to insert. If it has "_key" or "_id"
|
|
@@ -3019,20 +3018,16 @@ class VertexCollection(Collection):
|
|
|
3019
3018
|
:type vertex: dict
|
|
3020
3019
|
:param sync: Block until operation is synchronized to disk.
|
|
3021
3020
|
:type sync: bool | None
|
|
3022
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3023
|
-
can be used to save resources.
|
|
3024
|
-
:type silent: bool
|
|
3025
3021
|
:param return_new: Include body of the new document in the returned
|
|
3026
3022
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3027
3023
|
:type return_new: bool
|
|
3028
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3029
|
-
|
|
3030
|
-
:rtype: bool | dict
|
|
3024
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3025
|
+
:rtype: dict
|
|
3031
3026
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
3032
3027
|
"""
|
|
3033
3028
|
vertex = self._ensure_key_from_id(vertex)
|
|
3034
3029
|
|
|
3035
|
-
params: Params = {"
|
|
3030
|
+
params: Params = {"returnNew": return_new}
|
|
3036
3031
|
if sync is not None:
|
|
3037
3032
|
params["waitForSync"] = sync
|
|
3038
3033
|
|
|
@@ -3044,11 +3039,9 @@ class VertexCollection(Collection):
|
|
|
3044
3039
|
write=self.name,
|
|
3045
3040
|
)
|
|
3046
3041
|
|
|
3047
|
-
def response_handler(resp: Response) ->
|
|
3042
|
+
def response_handler(resp: Response) -> Json:
|
|
3048
3043
|
if not resp.is_success:
|
|
3049
3044
|
raise DocumentInsertError(resp, request)
|
|
3050
|
-
if silent:
|
|
3051
|
-
return True
|
|
3052
3045
|
return format_vertex(resp.body)
|
|
3053
3046
|
|
|
3054
3047
|
return self._execute(request, response_handler)
|
|
@@ -3059,10 +3052,9 @@ class VertexCollection(Collection):
|
|
|
3059
3052
|
check_rev: bool = True,
|
|
3060
3053
|
keep_none: bool = True,
|
|
3061
3054
|
sync: Optional[bool] = None,
|
|
3062
|
-
silent: bool = False,
|
|
3063
3055
|
return_old: bool = False,
|
|
3064
3056
|
return_new: bool = False,
|
|
3065
|
-
) -> Result[
|
|
3057
|
+
) -> Result[Json]:
|
|
3066
3058
|
"""Update a vertex document.
|
|
3067
3059
|
|
|
3068
3060
|
:param vertex: Partial or full vertex document with updated values. It
|
|
@@ -3076,18 +3068,14 @@ class VertexCollection(Collection):
|
|
|
3076
3068
|
:type keep_none: bool | None
|
|
3077
3069
|
:param sync: Block until operation is synchronized to disk.
|
|
3078
3070
|
:type sync: bool | None
|
|
3079
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3080
|
-
can be used to save resources.
|
|
3081
|
-
:type silent: bool
|
|
3082
3071
|
:param return_old: Include body of the old document in the returned
|
|
3083
3072
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3084
3073
|
:type return_old: bool
|
|
3085
3074
|
:param return_new: Include body of the new document in the returned
|
|
3086
3075
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3087
3076
|
:type return_new: bool
|
|
3088
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3089
|
-
|
|
3090
|
-
:rtype: bool | dict
|
|
3077
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3078
|
+
:rtype: dict
|
|
3091
3079
|
:raise arango.exceptions.DocumentUpdateError: If update fails.
|
|
3092
3080
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3093
3081
|
"""
|
|
@@ -3096,7 +3084,6 @@ class VertexCollection(Collection):
|
|
|
3096
3084
|
params: Params = {
|
|
3097
3085
|
"keepNull": keep_none,
|
|
3098
3086
|
"overwrite": not check_rev,
|
|
3099
|
-
"silent": silent,
|
|
3100
3087
|
"returnNew": return_new,
|
|
3101
3088
|
"returnOld": return_old,
|
|
3102
3089
|
}
|
|
@@ -3112,13 +3099,11 @@ class VertexCollection(Collection):
|
|
|
3112
3099
|
write=self.name,
|
|
3113
3100
|
)
|
|
3114
3101
|
|
|
3115
|
-
def response_handler(resp: Response) ->
|
|
3102
|
+
def response_handler(resp: Response) -> Json:
|
|
3116
3103
|
if resp.status_code == 412: # pragma: no cover
|
|
3117
3104
|
raise DocumentRevisionError(resp, request)
|
|
3118
3105
|
elif not resp.is_success:
|
|
3119
3106
|
raise DocumentUpdateError(resp, request)
|
|
3120
|
-
if silent is True:
|
|
3121
|
-
return True
|
|
3122
3107
|
return format_vertex(resp.body)
|
|
3123
3108
|
|
|
3124
3109
|
return self._execute(request, response_handler)
|
|
@@ -3128,10 +3113,9 @@ class VertexCollection(Collection):
|
|
|
3128
3113
|
vertex: Json,
|
|
3129
3114
|
check_rev: bool = True,
|
|
3130
3115
|
sync: Optional[bool] = None,
|
|
3131
|
-
silent: bool = False,
|
|
3132
3116
|
return_old: bool = False,
|
|
3133
3117
|
return_new: bool = False,
|
|
3134
|
-
) -> Result[
|
|
3118
|
+
) -> Result[Json]:
|
|
3135
3119
|
"""Replace a vertex document.
|
|
3136
3120
|
|
|
3137
3121
|
:param vertex: New vertex document to replace the old one with. It must
|
|
@@ -3142,25 +3126,20 @@ class VertexCollection(Collection):
|
|
|
3142
3126
|
:type check_rev: bool
|
|
3143
3127
|
:param sync: Block until operation is synchronized to disk.
|
|
3144
3128
|
:type sync: bool | None
|
|
3145
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3146
|
-
can be used to save resources.
|
|
3147
|
-
:type silent: bool
|
|
3148
3129
|
:param return_old: Include body of the old document in the returned
|
|
3149
3130
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3150
3131
|
:type return_old: bool
|
|
3151
3132
|
:param return_new: Include body of the new document in the returned
|
|
3152
3133
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3153
3134
|
:type return_new: bool
|
|
3154
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3155
|
-
|
|
3156
|
-
:rtype: bool | dict
|
|
3135
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3136
|
+
:rtype: dict
|
|
3157
3137
|
:raise arango.exceptions.DocumentReplaceError: If replace fails.
|
|
3158
3138
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3159
3139
|
"""
|
|
3160
3140
|
vertex_id, headers = self._prep_from_body(vertex, check_rev)
|
|
3161
3141
|
|
|
3162
3142
|
params: Params = {
|
|
3163
|
-
"silent": silent,
|
|
3164
3143
|
"returnNew": return_new,
|
|
3165
3144
|
"returnOld": return_old,
|
|
3166
3145
|
}
|
|
@@ -3176,13 +3155,11 @@ class VertexCollection(Collection):
|
|
|
3176
3155
|
write=self.name,
|
|
3177
3156
|
)
|
|
3178
3157
|
|
|
3179
|
-
def response_handler(resp: Response) ->
|
|
3158
|
+
def response_handler(resp: Response) -> Json:
|
|
3180
3159
|
if resp.status_code == 412: # pragma: no cover
|
|
3181
3160
|
raise DocumentRevisionError(resp, request)
|
|
3182
3161
|
elif not resp.is_success:
|
|
3183
3162
|
raise DocumentReplaceError(resp, request)
|
|
3184
|
-
if silent is True:
|
|
3185
|
-
return True
|
|
3186
3163
|
return format_vertex(resp.body)
|
|
3187
3164
|
|
|
3188
3165
|
return self._execute(request, response_handler)
|
|
@@ -3326,9 +3303,8 @@ class EdgeCollection(Collection):
|
|
|
3326
3303
|
self,
|
|
3327
3304
|
edge: Json,
|
|
3328
3305
|
sync: Optional[bool] = None,
|
|
3329
|
-
silent: bool = False,
|
|
3330
3306
|
return_new: bool = False,
|
|
3331
|
-
) -> Result[
|
|
3307
|
+
) -> Result[Json]:
|
|
3332
3308
|
"""Insert a new edge document.
|
|
3333
3309
|
|
|
3334
3310
|
:param edge: New edge document to insert. It must contain "_from" and
|
|
@@ -3338,20 +3314,16 @@ class EdgeCollection(Collection):
|
|
|
3338
3314
|
:type edge: dict
|
|
3339
3315
|
:param sync: Block until operation is synchronized to disk.
|
|
3340
3316
|
:type sync: bool | None
|
|
3341
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3342
|
-
can be used to save resources.
|
|
3343
|
-
:type silent: bool
|
|
3344
3317
|
:param return_new: Include body of the new document in the returned
|
|
3345
3318
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3346
3319
|
:type return_new: bool
|
|
3347
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3348
|
-
|
|
3349
|
-
:rtype: bool | dict
|
|
3320
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3321
|
+
:rtype: dict
|
|
3350
3322
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
3351
3323
|
"""
|
|
3352
3324
|
edge = self._ensure_key_from_id(edge)
|
|
3353
3325
|
|
|
3354
|
-
params: Params = {"
|
|
3326
|
+
params: Params = {"returnNew": return_new}
|
|
3355
3327
|
if sync is not None:
|
|
3356
3328
|
params["waitForSync"] = sync
|
|
3357
3329
|
|
|
@@ -3363,11 +3335,9 @@ class EdgeCollection(Collection):
|
|
|
3363
3335
|
write=self.name,
|
|
3364
3336
|
)
|
|
3365
3337
|
|
|
3366
|
-
def response_handler(resp: Response) ->
|
|
3338
|
+
def response_handler(resp: Response) -> Json:
|
|
3367
3339
|
if not resp.is_success:
|
|
3368
3340
|
raise DocumentInsertError(resp, request)
|
|
3369
|
-
if silent:
|
|
3370
|
-
return True
|
|
3371
3341
|
return format_edge(resp.body)
|
|
3372
3342
|
|
|
3373
3343
|
return self._execute(request, response_handler)
|
|
@@ -3378,10 +3348,9 @@ class EdgeCollection(Collection):
|
|
|
3378
3348
|
check_rev: bool = True,
|
|
3379
3349
|
keep_none: bool = True,
|
|
3380
3350
|
sync: Optional[bool] = None,
|
|
3381
|
-
silent: bool = False,
|
|
3382
3351
|
return_old: bool = False,
|
|
3383
3352
|
return_new: bool = False,
|
|
3384
|
-
) -> Result[
|
|
3353
|
+
) -> Result[Json]:
|
|
3385
3354
|
"""Update an edge document.
|
|
3386
3355
|
|
|
3387
3356
|
:param edge: Partial or full edge document with updated values. It must
|
|
@@ -3395,18 +3364,14 @@ class EdgeCollection(Collection):
|
|
|
3395
3364
|
:type keep_none: bool | None
|
|
3396
3365
|
:param sync: Block until operation is synchronized to disk.
|
|
3397
3366
|
:type sync: bool | None
|
|
3398
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3399
|
-
can be used to save resources.
|
|
3400
|
-
:type silent: bool
|
|
3401
3367
|
:param return_old: Include body of the old document in the returned
|
|
3402
3368
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3403
3369
|
:type return_old: bool
|
|
3404
3370
|
:param return_new: Include body of the new document in the returned
|
|
3405
3371
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3406
3372
|
:type return_new: bool
|
|
3407
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3408
|
-
|
|
3409
|
-
:rtype: bool | dict
|
|
3373
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3374
|
+
:rtype: dict
|
|
3410
3375
|
:raise arango.exceptions.DocumentUpdateError: If update fails.
|
|
3411
3376
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3412
3377
|
"""
|
|
@@ -3415,7 +3380,6 @@ class EdgeCollection(Collection):
|
|
|
3415
3380
|
params: Params = {
|
|
3416
3381
|
"keepNull": keep_none,
|
|
3417
3382
|
"overwrite": not check_rev,
|
|
3418
|
-
"silent": silent,
|
|
3419
3383
|
"returnNew": return_new,
|
|
3420
3384
|
"returnOld": return_old,
|
|
3421
3385
|
}
|
|
@@ -3431,13 +3395,11 @@ class EdgeCollection(Collection):
|
|
|
3431
3395
|
write=self.name,
|
|
3432
3396
|
)
|
|
3433
3397
|
|
|
3434
|
-
def response_handler(resp: Response) ->
|
|
3398
|
+
def response_handler(resp: Response) -> Json:
|
|
3435
3399
|
if resp.status_code == 412: # pragma: no cover
|
|
3436
3400
|
raise DocumentRevisionError(resp, request)
|
|
3437
3401
|
if not resp.is_success:
|
|
3438
3402
|
raise DocumentUpdateError(resp, request)
|
|
3439
|
-
if silent is True:
|
|
3440
|
-
return True
|
|
3441
3403
|
return format_edge(resp.body)
|
|
3442
3404
|
|
|
3443
3405
|
return self._execute(request, response_handler)
|
|
@@ -3447,10 +3409,9 @@ class EdgeCollection(Collection):
|
|
|
3447
3409
|
edge: Json,
|
|
3448
3410
|
check_rev: bool = True,
|
|
3449
3411
|
sync: Optional[bool] = None,
|
|
3450
|
-
silent: bool = False,
|
|
3451
3412
|
return_old: bool = False,
|
|
3452
3413
|
return_new: bool = False,
|
|
3453
|
-
) -> Result[
|
|
3414
|
+
) -> Result[Json]:
|
|
3454
3415
|
"""Replace an edge document.
|
|
3455
3416
|
|
|
3456
3417
|
:param edge: New edge document to replace the old one with. It must
|
|
@@ -3462,25 +3423,20 @@ class EdgeCollection(Collection):
|
|
|
3462
3423
|
:type check_rev: bool
|
|
3463
3424
|
:param sync: Block until operation is synchronized to disk.
|
|
3464
3425
|
:type sync: bool | None
|
|
3465
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3466
|
-
can be used to save resources.
|
|
3467
|
-
:type silent: bool
|
|
3468
3426
|
:param return_old: Include body of the old document in the returned
|
|
3469
3427
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3470
3428
|
:type return_old: bool
|
|
3471
3429
|
:param return_new: Include body of the new document in the returned
|
|
3472
3430
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3473
3431
|
:type return_new: bool
|
|
3474
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3475
|
-
|
|
3476
|
-
:rtype: bool | dict
|
|
3432
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3433
|
+
:rtype: dict
|
|
3477
3434
|
:raise arango.exceptions.DocumentReplaceError: If replace fails.
|
|
3478
3435
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3479
3436
|
"""
|
|
3480
3437
|
edge_id, headers = self._prep_from_body(edge, check_rev)
|
|
3481
3438
|
|
|
3482
3439
|
params: Params = {
|
|
3483
|
-
"silent": silent,
|
|
3484
3440
|
"returnNew": return_new,
|
|
3485
3441
|
"returnOld": return_old,
|
|
3486
3442
|
}
|
|
@@ -3496,13 +3452,11 @@ class EdgeCollection(Collection):
|
|
|
3496
3452
|
write=self.name,
|
|
3497
3453
|
)
|
|
3498
3454
|
|
|
3499
|
-
def response_handler(resp: Response) ->
|
|
3455
|
+
def response_handler(resp: Response) -> Json:
|
|
3500
3456
|
if resp.status_code == 412: # pragma: no cover
|
|
3501
3457
|
raise DocumentRevisionError(resp, request)
|
|
3502
3458
|
if not resp.is_success:
|
|
3503
3459
|
raise DocumentReplaceError(resp, request)
|
|
3504
|
-
if silent is True:
|
|
3505
|
-
return True
|
|
3506
3460
|
return format_edge(resp.body)
|
|
3507
3461
|
|
|
3508
3462
|
return self._execute(request, response_handler)
|
|
@@ -3575,9 +3529,8 @@ class EdgeCollection(Collection):
|
|
|
3575
3529
|
to_vertex: Union[str, Json],
|
|
3576
3530
|
data: Optional[Json] = None,
|
|
3577
3531
|
sync: Optional[bool] = None,
|
|
3578
|
-
silent: bool = False,
|
|
3579
3532
|
return_new: bool = False,
|
|
3580
|
-
) -> Result[
|
|
3533
|
+
) -> Result[Json]:
|
|
3581
3534
|
"""Insert a new edge document linking the given vertices.
|
|
3582
3535
|
|
|
3583
3536
|
:param from_vertex: "From" vertex document ID or body with "_id" field.
|
|
@@ -3590,21 +3543,17 @@ class EdgeCollection(Collection):
|
|
|
3590
3543
|
:type data: dict | None
|
|
3591
3544
|
:param sync: Block until operation is synchronized to disk.
|
|
3592
3545
|
:type sync: bool | None
|
|
3593
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3594
|
-
can be used to save resources.
|
|
3595
|
-
:type silent: bool
|
|
3596
3546
|
:param return_new: Include body of the new document in the returned
|
|
3597
3547
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3598
3548
|
:type return_new: bool
|
|
3599
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3600
|
-
|
|
3601
|
-
:rtype: bool | dict
|
|
3549
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3550
|
+
:rtype: dict
|
|
3602
3551
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
3603
3552
|
"""
|
|
3604
3553
|
edge = {"_from": get_doc_id(from_vertex), "_to": get_doc_id(to_vertex)}
|
|
3605
3554
|
if data is not None:
|
|
3606
3555
|
edge.update(self._ensure_key_from_id(data))
|
|
3607
|
-
return self.insert(edge, sync=sync,
|
|
3556
|
+
return self.insert(edge, sync=sync, return_new=return_new)
|
|
3608
3557
|
|
|
3609
3558
|
def edges(
|
|
3610
3559
|
self,
|
|
@@ -543,6 +543,10 @@ class VertexCollectionDeleteError(ArangoServerError):
|
|
|
543
543
|
"""Failed to delete vertex collection."""
|
|
544
544
|
|
|
545
545
|
|
|
546
|
+
class EdgeCollectionListError(ArangoServerError):
|
|
547
|
+
"""Failed to retrieve edge collections."""
|
|
548
|
+
|
|
549
|
+
|
|
546
550
|
class EdgeDefinitionListError(ArangoServerError):
|
|
547
551
|
"""Failed to retrieve edge definitions."""
|
|
548
552
|
|
|
@@ -7,6 +7,7 @@ from arango.api import ApiGroup
|
|
|
7
7
|
from arango.collection import EdgeCollection, VertexCollection
|
|
8
8
|
from arango.connection import Connection
|
|
9
9
|
from arango.exceptions import (
|
|
10
|
+
EdgeCollectionListError,
|
|
10
11
|
EdgeDefinitionCreateError,
|
|
11
12
|
EdgeDefinitionDeleteError,
|
|
12
13
|
EdgeDefinitionListError,
|
|
@@ -136,19 +137,28 @@ class Graph(ApiGroup):
|
|
|
136
137
|
"""
|
|
137
138
|
return VertexCollection(self._conn, self._executor, self._name, name)
|
|
138
139
|
|
|
139
|
-
def create_vertex_collection(
|
|
140
|
+
def create_vertex_collection(
|
|
141
|
+
self,
|
|
142
|
+
name: str,
|
|
143
|
+
options: Optional[Json] = None,
|
|
144
|
+
) -> Result[VertexCollection]:
|
|
140
145
|
"""Create a vertex collection in the graph.
|
|
141
146
|
|
|
142
147
|
:param name: Vertex collection name.
|
|
143
148
|
:type name: str
|
|
149
|
+
:param options: Additional options for creating vertex collections.
|
|
150
|
+
:type options: dict | None
|
|
144
151
|
:return: Vertex collection API wrapper.
|
|
145
152
|
:rtype: arango.collection.VertexCollection
|
|
146
153
|
:raise arango.exceptions.VertexCollectionCreateError: If create fails.
|
|
147
154
|
"""
|
|
155
|
+
data: Json = {"collection": name}
|
|
156
|
+
if options is not None:
|
|
157
|
+
data["options"] = options
|
|
148
158
|
request = Request(
|
|
149
159
|
method="post",
|
|
150
160
|
endpoint=f"/_api/gharial/{self._name}/vertex",
|
|
151
|
-
data=
|
|
161
|
+
data=data,
|
|
152
162
|
)
|
|
153
163
|
|
|
154
164
|
def response_handler(resp: Response) -> VertexCollection:
|
|
@@ -259,6 +269,7 @@ class Graph(ApiGroup):
|
|
|
259
269
|
edge_collection: str,
|
|
260
270
|
from_vertex_collections: Sequence[str],
|
|
261
271
|
to_vertex_collections: Sequence[str],
|
|
272
|
+
options: Optional[Json] = None,
|
|
262
273
|
) -> Result[EdgeCollection]:
|
|
263
274
|
"""Create a new edge definition.
|
|
264
275
|
|
|
@@ -279,18 +290,24 @@ class Graph(ApiGroup):
|
|
|
279
290
|
:type from_vertex_collections: [str]
|
|
280
291
|
:param to_vertex_collections: Names of "to" vertex collections.
|
|
281
292
|
:type to_vertex_collections: [str]
|
|
293
|
+
:param options: Additional options for creating edge definitions.
|
|
294
|
+
:type options: dict | None
|
|
282
295
|
:return: Edge collection API wrapper.
|
|
283
296
|
:rtype: arango.collection.EdgeCollection
|
|
284
297
|
:raise arango.exceptions.EdgeDefinitionCreateError: If create fails.
|
|
285
298
|
"""
|
|
299
|
+
data: Json = {
|
|
300
|
+
"collection": edge_collection,
|
|
301
|
+
"from": from_vertex_collections,
|
|
302
|
+
"to": to_vertex_collections,
|
|
303
|
+
}
|
|
304
|
+
if options is not None:
|
|
305
|
+
data["options"] = options
|
|
306
|
+
|
|
286
307
|
request = Request(
|
|
287
308
|
method="post",
|
|
288
309
|
endpoint=f"/_api/gharial/{self._name}/edge",
|
|
289
|
-
data=
|
|
290
|
-
"collection": edge_collection,
|
|
291
|
-
"from": from_vertex_collections,
|
|
292
|
-
"to": to_vertex_collections,
|
|
293
|
-
},
|
|
310
|
+
data=data,
|
|
294
311
|
)
|
|
295
312
|
|
|
296
313
|
def response_handler(resp: Response) -> EdgeCollection:
|
|
@@ -300,11 +317,32 @@ class Graph(ApiGroup):
|
|
|
300
317
|
|
|
301
318
|
return self._execute(request, response_handler)
|
|
302
319
|
|
|
320
|
+
def edge_collections(self) -> Result[List[str]]:
|
|
321
|
+
"""Get the names of all edge collections in the graph.
|
|
322
|
+
|
|
323
|
+
:return: Edge collections in the graph.
|
|
324
|
+
:rtype: list
|
|
325
|
+
:raise: arango.exceptions.EdgeCollectionListError: If retrieval fails.
|
|
326
|
+
"""
|
|
327
|
+
request = Request(
|
|
328
|
+
method="get",
|
|
329
|
+
endpoint=f"/_api/gharial/{self._name}/edge",
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
def response_handler(resp: Response) -> List[str]:
|
|
333
|
+
if not resp.is_success:
|
|
334
|
+
raise EdgeCollectionListError(resp, request)
|
|
335
|
+
return list(sorted(resp.body["collections"]))
|
|
336
|
+
|
|
337
|
+
return self._execute(request, response_handler)
|
|
338
|
+
|
|
303
339
|
def replace_edge_definition(
|
|
304
340
|
self,
|
|
305
341
|
edge_collection: str,
|
|
306
342
|
from_vertex_collections: Sequence[str],
|
|
307
343
|
to_vertex_collections: Sequence[str],
|
|
344
|
+
sync: Optional[bool] = None,
|
|
345
|
+
purge: bool = False,
|
|
308
346
|
) -> Result[EdgeCollection]:
|
|
309
347
|
"""Replace an edge definition.
|
|
310
348
|
|
|
@@ -314,18 +352,28 @@ class Graph(ApiGroup):
|
|
|
314
352
|
:type from_vertex_collections: [str]
|
|
315
353
|
:param to_vertex_collections: Names of "to" vertex collections.
|
|
316
354
|
:type to_vertex_collections: [str]
|
|
355
|
+
:param sync: Block until operation is synchronized to disk.
|
|
356
|
+
:type sync: bool | None
|
|
357
|
+
:param purge: Drop the edge collection in addition to removing it from
|
|
358
|
+
the graph. The collection is only dropped if it is not used in other graphs.
|
|
359
|
+
:type purge: bool
|
|
317
360
|
:return: Edge collection API wrapper.
|
|
318
361
|
:rtype: arango.collection.EdgeCollection
|
|
319
362
|
:raise arango.exceptions.EdgeDefinitionReplaceError: If replace fails.
|
|
320
363
|
"""
|
|
364
|
+
data: Json = {
|
|
365
|
+
"collection": edge_collection,
|
|
366
|
+
"from": from_vertex_collections,
|
|
367
|
+
"to": to_vertex_collections,
|
|
368
|
+
"purge": purge,
|
|
369
|
+
}
|
|
370
|
+
if sync is not None:
|
|
371
|
+
data["waitForSync"] = sync
|
|
372
|
+
|
|
321
373
|
request = Request(
|
|
322
374
|
method="put",
|
|
323
375
|
endpoint=f"/_api/gharial/{self._name}/edge/{edge_collection}",
|
|
324
|
-
data=
|
|
325
|
-
"collection": edge_collection,
|
|
326
|
-
"from": from_vertex_collections,
|
|
327
|
-
"to": to_vertex_collections,
|
|
328
|
-
},
|
|
376
|
+
data=data,
|
|
329
377
|
)
|
|
330
378
|
|
|
331
379
|
def response_handler(resp: Response) -> EdgeCollection:
|
|
@@ -335,7 +383,12 @@ class Graph(ApiGroup):
|
|
|
335
383
|
|
|
336
384
|
return self._execute(request, response_handler)
|
|
337
385
|
|
|
338
|
-
def delete_edge_definition(
|
|
386
|
+
def delete_edge_definition(
|
|
387
|
+
self,
|
|
388
|
+
name: str,
|
|
389
|
+
purge: bool = False,
|
|
390
|
+
sync: Optional[bool] = None,
|
|
391
|
+
) -> Result[bool]:
|
|
339
392
|
"""Delete an edge definition from the graph.
|
|
340
393
|
|
|
341
394
|
:param name: Edge collection name.
|
|
@@ -344,14 +397,20 @@ class Graph(ApiGroup):
|
|
|
344
397
|
from the graph but the edge collection is also deleted completely
|
|
345
398
|
from the database.
|
|
346
399
|
:type purge: bool
|
|
400
|
+
:sync: Block until operation is synchronized to disk.
|
|
401
|
+
:type sync: bool | None
|
|
347
402
|
:return: True if edge definition was deleted successfully.
|
|
348
403
|
:rtype: bool
|
|
349
404
|
:raise arango.exceptions.EdgeDefinitionDeleteError: If delete fails.
|
|
350
405
|
"""
|
|
406
|
+
params: Json = {"dropCollections": purge}
|
|
407
|
+
if sync is not None:
|
|
408
|
+
params["waitForSync"] = sync
|
|
409
|
+
|
|
351
410
|
request = Request(
|
|
352
411
|
method="delete",
|
|
353
412
|
endpoint=f"/_api/gharial/{self._name}/edge/{name}",
|
|
354
|
-
params=
|
|
413
|
+
params=params,
|
|
355
414
|
)
|
|
356
415
|
|
|
357
416
|
def response_handler(resp: Response) -> bool:
|
|
@@ -549,8 +608,7 @@ class Graph(ApiGroup):
|
|
|
549
608
|
collection: str,
|
|
550
609
|
vertex: Json,
|
|
551
610
|
sync: Optional[bool] = None,
|
|
552
|
-
|
|
553
|
-
) -> Result[Union[bool, Json]]:
|
|
611
|
+
) -> Result[Json]:
|
|
554
612
|
"""Insert a new vertex document.
|
|
555
613
|
|
|
556
614
|
:param collection: Vertex collection name.
|
|
@@ -561,15 +619,11 @@ class Graph(ApiGroup):
|
|
|
561
619
|
:type vertex: dict
|
|
562
620
|
:param sync: Block until operation is synchronized to disk.
|
|
563
621
|
:type sync: bool | None
|
|
564
|
-
:
|
|
565
|
-
|
|
566
|
-
:type silent: bool
|
|
567
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
568
|
-
parameter **silent** was set to True.
|
|
569
|
-
:rtype: bool | dict
|
|
622
|
+
:return: Document metadata (e.g. document key, revision).
|
|
623
|
+
:rtype: dict
|
|
570
624
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
571
625
|
"""
|
|
572
|
-
return self.vertex_collection(collection).insert(vertex, sync
|
|
626
|
+
return self.vertex_collection(collection).insert(vertex, sync)
|
|
573
627
|
|
|
574
628
|
def update_vertex(
|
|
575
629
|
self,
|
|
@@ -577,8 +631,7 @@ class Graph(ApiGroup):
|
|
|
577
631
|
check_rev: bool = True,
|
|
578
632
|
keep_none: bool = True,
|
|
579
633
|
sync: Optional[bool] = None,
|
|
580
|
-
|
|
581
|
-
) -> Result[Union[bool, Json]]:
|
|
634
|
+
) -> Result[Json]:
|
|
582
635
|
"""Update a vertex document.
|
|
583
636
|
|
|
584
637
|
:param vertex: Partial or full vertex document with updated values. It
|
|
@@ -592,12 +645,8 @@ class Graph(ApiGroup):
|
|
|
592
645
|
:type keep_none: bool
|
|
593
646
|
:param sync: Block until operation is synchronized to disk.
|
|
594
647
|
:type sync: bool | None
|
|
595
|
-
:
|
|
596
|
-
|
|
597
|
-
:type silent: bool
|
|
598
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
599
|
-
parameter **silent** was set to True.
|
|
600
|
-
:rtype: bool | dict
|
|
648
|
+
:return: Document metadata (e.g. document key, revision).
|
|
649
|
+
:rtype: dict
|
|
601
650
|
:raise arango.exceptions.DocumentUpdateError: If update fails.
|
|
602
651
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
603
652
|
"""
|
|
@@ -606,7 +655,6 @@ class Graph(ApiGroup):
|
|
|
606
655
|
check_rev=check_rev,
|
|
607
656
|
keep_none=keep_none,
|
|
608
657
|
sync=sync,
|
|
609
|
-
silent=silent,
|
|
610
658
|
)
|
|
611
659
|
|
|
612
660
|
def replace_vertex(
|
|
@@ -614,8 +662,7 @@ class Graph(ApiGroup):
|
|
|
614
662
|
vertex: Json,
|
|
615
663
|
check_rev: bool = True,
|
|
616
664
|
sync: Optional[bool] = None,
|
|
617
|
-
|
|
618
|
-
) -> Result[Union[bool, Json]]:
|
|
665
|
+
) -> Result[Json]:
|
|
619
666
|
"""Replace a vertex document.
|
|
620
667
|
|
|
621
668
|
:param vertex: New vertex document to replace the old one with. It must
|
|
@@ -626,17 +673,15 @@ class Graph(ApiGroup):
|
|
|
626
673
|
:type check_rev: bool
|
|
627
674
|
:param sync: Block until operation is synchronized to disk.
|
|
628
675
|
:type sync: bool | None
|
|
629
|
-
:
|
|
630
|
-
|
|
631
|
-
:type silent: bool
|
|
632
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
633
|
-
parameter **silent** was set to True.
|
|
634
|
-
:rtype: bool | dict
|
|
676
|
+
:return: Document metadata (e.g. document key, revision).
|
|
677
|
+
:rtype: dict
|
|
635
678
|
:raise arango.exceptions.DocumentReplaceError: If replace fails.
|
|
636
679
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
637
680
|
"""
|
|
638
681
|
return self._get_col_by_vertex(vertex).replace(
|
|
639
|
-
vertex=vertex,
|
|
682
|
+
vertex=vertex,
|
|
683
|
+
check_rev=check_rev,
|
|
684
|
+
sync=sync,
|
|
640
685
|
)
|
|
641
686
|
|
|
642
687
|
def delete_vertex(
|
|
@@ -727,8 +772,7 @@ class Graph(ApiGroup):
|
|
|
727
772
|
collection: str,
|
|
728
773
|
edge: Json,
|
|
729
774
|
sync: Optional[bool] = None,
|
|
730
|
-
|
|
731
|
-
) -> Result[Union[bool, Json]]:
|
|
775
|
+
) -> Result[Json]:
|
|
732
776
|
"""Insert a new edge document.
|
|
733
777
|
|
|
734
778
|
:param collection: Edge collection name.
|
|
@@ -740,15 +784,11 @@ class Graph(ApiGroup):
|
|
|
740
784
|
:type edge: dict
|
|
741
785
|
:param sync: Block until operation is synchronized to disk.
|
|
742
786
|
:type sync: bool | None
|
|
743
|
-
:
|
|
744
|
-
|
|
745
|
-
:type silent: bool
|
|
746
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
747
|
-
parameter **silent** was set to True.
|
|
748
|
-
:rtype: bool | dict
|
|
787
|
+
:return: Document metadata (e.g. document key, revision).
|
|
788
|
+
:rtype: dict
|
|
749
789
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
750
790
|
"""
|
|
751
|
-
return self.edge_collection(collection).insert(edge, sync
|
|
791
|
+
return self.edge_collection(collection).insert(edge, sync)
|
|
752
792
|
|
|
753
793
|
def update_edge(
|
|
754
794
|
self,
|
|
@@ -756,8 +796,7 @@ class Graph(ApiGroup):
|
|
|
756
796
|
check_rev: bool = True,
|
|
757
797
|
keep_none: bool = True,
|
|
758
798
|
sync: Optional[bool] = None,
|
|
759
|
-
|
|
760
|
-
) -> Result[Union[bool, Json]]:
|
|
799
|
+
) -> Result[Json]:
|
|
761
800
|
"""Update an edge document.
|
|
762
801
|
|
|
763
802
|
:param edge: Partial or full edge document with updated values. It must
|
|
@@ -771,12 +810,8 @@ class Graph(ApiGroup):
|
|
|
771
810
|
:type keep_none: bool | None
|
|
772
811
|
:param sync: Block until operation is synchronized to disk.
|
|
773
812
|
:type sync: bool | None
|
|
774
|
-
:
|
|
775
|
-
|
|
776
|
-
:type silent: bool
|
|
777
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
778
|
-
parameter **silent** was set to True.
|
|
779
|
-
:rtype: bool | dict
|
|
813
|
+
:return: Document metadata (e.g. document key, revision).
|
|
814
|
+
:rtype: dict
|
|
780
815
|
:raise arango.exceptions.DocumentUpdateError: If update fails.
|
|
781
816
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
782
817
|
"""
|
|
@@ -785,7 +820,6 @@ class Graph(ApiGroup):
|
|
|
785
820
|
check_rev=check_rev,
|
|
786
821
|
keep_none=keep_none,
|
|
787
822
|
sync=sync,
|
|
788
|
-
silent=silent,
|
|
789
823
|
)
|
|
790
824
|
|
|
791
825
|
def replace_edge(
|
|
@@ -793,8 +827,7 @@ class Graph(ApiGroup):
|
|
|
793
827
|
edge: Json,
|
|
794
828
|
check_rev: bool = True,
|
|
795
829
|
sync: Optional[bool] = None,
|
|
796
|
-
|
|
797
|
-
) -> Result[Union[bool, Json]]:
|
|
830
|
+
) -> Result[Json]:
|
|
798
831
|
"""Replace an edge document.
|
|
799
832
|
|
|
800
833
|
:param edge: New edge document to replace the old one with. It must
|
|
@@ -806,17 +839,15 @@ class Graph(ApiGroup):
|
|
|
806
839
|
:type check_rev: bool
|
|
807
840
|
:param sync: Block until operation is synchronized to disk.
|
|
808
841
|
:type sync: bool | None
|
|
809
|
-
:
|
|
810
|
-
|
|
811
|
-
:type silent: bool
|
|
812
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
813
|
-
parameter **silent** was set to True.
|
|
814
|
-
:rtype: bool | dict
|
|
842
|
+
:return: Document metadata (e.g. document key, revision).
|
|
843
|
+
:rtype: dict
|
|
815
844
|
:raise arango.exceptions.DocumentReplaceError: If replace fails.
|
|
816
845
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
817
846
|
"""
|
|
818
847
|
return self._get_col_by_edge(edge).replace(
|
|
819
|
-
edge=edge,
|
|
848
|
+
edge=edge,
|
|
849
|
+
check_rev=check_rev,
|
|
850
|
+
sync=sync,
|
|
820
851
|
)
|
|
821
852
|
|
|
822
853
|
def delete_edge(
|
|
@@ -865,8 +896,7 @@ class Graph(ApiGroup):
|
|
|
865
896
|
to_vertex: Union[str, Json],
|
|
866
897
|
data: Optional[Json] = None,
|
|
867
898
|
sync: Optional[bool] = None,
|
|
868
|
-
|
|
869
|
-
) -> Result[Union[bool, Json]]:
|
|
899
|
+
) -> Result[Json]:
|
|
870
900
|
"""Insert a new edge document linking the given vertices.
|
|
871
901
|
|
|
872
902
|
:param collection: Edge collection name.
|
|
@@ -881,12 +911,8 @@ class Graph(ApiGroup):
|
|
|
881
911
|
:type data: dict
|
|
882
912
|
:param sync: Block until operation is synchronized to disk.
|
|
883
913
|
:type sync: bool | None
|
|
884
|
-
:
|
|
885
|
-
|
|
886
|
-
:type silent: bool
|
|
887
|
-
:return: Document metadata (e.g. document key, revision) or True if
|
|
888
|
-
parameter **silent** was set to True.
|
|
889
|
-
:rtype: bool | dict
|
|
914
|
+
:return: Document metadata (e.g. document key, revision).
|
|
915
|
+
:rtype: dict
|
|
890
916
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
891
917
|
"""
|
|
892
918
|
return self.edge_collection(collection).link(
|
|
@@ -894,7 +920,6 @@ class Graph(ApiGroup):
|
|
|
894
920
|
to_vertex=to_vertex,
|
|
895
921
|
data=data,
|
|
896
922
|
sync=sync,
|
|
897
|
-
silent=silent,
|
|
898
923
|
)
|
|
899
924
|
|
|
900
925
|
def edges(
|
|
@@ -12,7 +12,7 @@ def normalize_headers(
|
|
|
12
12
|
if driver_flags is not None:
|
|
13
13
|
for flag in driver_flags:
|
|
14
14
|
flags = flags + flag + ";"
|
|
15
|
-
driver_version = "8.
|
|
15
|
+
driver_version = "8.2.0"
|
|
16
16
|
driver_header = "python-arango/" + driver_version + " (" + flags + ")"
|
|
17
17
|
normalized_headers: Headers = {
|
|
18
18
|
"charset": "utf-8",
|
|
@@ -83,6 +83,7 @@ Here is an example showing how edge definitions are managed:
|
|
|
83
83
|
|
|
84
84
|
# Create an edge definition named "teach". This creates any missing
|
|
85
85
|
# collections and returns an API wrapper for "teach" edge collection.
|
|
86
|
+
# At first, create a wrong teachers->teachers mapping intentionally.
|
|
86
87
|
if not school.has_edge_definition('teach'):
|
|
87
88
|
teach = school.create_edge_definition(
|
|
88
89
|
edge_collection='teach',
|
|
@@ -93,7 +94,7 @@ Here is an example showing how edge definitions are managed:
|
|
|
93
94
|
# List edge definitions.
|
|
94
95
|
school.edge_definitions()
|
|
95
96
|
|
|
96
|
-
# Replace the edge definition.
|
|
97
|
+
# Replace with the correct edge definition.
|
|
97
98
|
school.replace_edge_definition(
|
|
98
99
|
edge_collection='teach',
|
|
99
100
|
from_vertex_collections=['teachers'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-arango
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.2.0
|
|
4
4
|
Summary: Python Driver for ArangoDB
|
|
5
5
|
Author-email: Joohwan Oh <joohwan.oh@outlook.com>
|
|
6
6
|
Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
|
|
@@ -133,7 +133,7 @@ cursor = db.aql.execute("FOR doc IN students RETURN doc")
|
|
|
133
133
|
student_names = [document["name"] for document in cursor]
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
Another example with [graphs](https://
|
|
136
|
+
Another example with [graphs](https://docs.arangodb.com/stable/graphs/):
|
|
137
137
|
|
|
138
138
|
```python
|
|
139
139
|
from arango import ArangoClient
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|