python-arango 8.1.6__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.6 → python_arango-8.2.0}/PKG-INFO +6 -3
- {python_arango-8.1.6 → python_arango-8.2.0}/README.md +3 -1
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/collection.py +72 -150
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/database.py +20 -5
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/exceptions.py +4 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/graph.py +102 -77
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/request.py +1 -1
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/utils.py +4 -4
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/graph.rst +2 -1
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/index.rst +3 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/python_arango.egg-info/PKG-INFO +6 -3
- {python_arango-8.1.6 → python_arango-8.2.0}/.circleci/config.yml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/.github/workflows/codeql.yaml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/.github/workflows/docs.yaml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/.github/workflows/pypi.yaml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/.gitignore +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/.pre-commit-config.yaml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/.readthedocs.yaml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/CONTRIBUTING.md +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/LICENSE +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/MANIFEST.in +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/__init__.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/api.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/aql.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/backup.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/client.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/cluster.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/connection.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/cursor.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/errno.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/executor.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/formatter.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/foxx.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/http.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/job.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/pregel.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/py.typed +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/replication.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/resolver.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/response.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/result.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/typings.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/arango/wal.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/Makefile +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/admin.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/analyzer.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/aql.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/async.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/auth.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/backup.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/batch.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/certificates.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/cluster.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/collection.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/compression.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/conf.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/contributing.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/cursor.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/database.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/document.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/errno.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/errors.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/foxx.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/http.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/indexes.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/logging.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/make.bat +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/overload.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/overview.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/pregel.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/replication.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/requirements.txt +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/schema.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/serializer.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/simple.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/specs.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/static/logo.png +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/task.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/threading.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/transaction.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/user.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/view.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/docs/wal.rst +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/pyproject.toml +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/python_arango.egg-info/SOURCES.txt +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/python_arango.egg-info/dependency_links.txt +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/python_arango.egg-info/requires.txt +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/python_arango.egg-info/top_level.txt +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/setup.cfg +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/setup.py +0 -0
- {python_arango-8.1.6 → python_arango-8.2.0}/starter.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
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>
|
|
@@ -62,6 +62,7 @@ Requires-Dist: sphinx; extra == "dev"
|
|
|
62
62
|
Requires-Dist: sphinx_rtd_theme; extra == "dev"
|
|
63
63
|
Requires-Dist: types-requests; extra == "dev"
|
|
64
64
|
Requires-Dist: types-setuptools; extra == "dev"
|
|
65
|
+
Dynamic: license-file
|
|
65
66
|
|
|
66
67
|

|
|
67
68
|
|
|
@@ -84,6 +85,8 @@ Requires-Dist: types-setuptools; extra == "dev"
|
|
|
84
85
|
Python driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model
|
|
85
86
|
database natively supporting documents, graphs and search.
|
|
86
87
|
|
|
88
|
+
If you're interested in using asyncio, please check [python-arango-async](https://github.com/arangodb/python-arango-async).
|
|
89
|
+
|
|
87
90
|
## Requirements
|
|
88
91
|
|
|
89
92
|
- ArangoDB version 3.11+
|
|
@@ -130,7 +133,7 @@ cursor = db.aql.execute("FOR doc IN students RETURN doc")
|
|
|
130
133
|
student_names = [document["name"] for document in cursor]
|
|
131
134
|
```
|
|
132
135
|
|
|
133
|
-
Another example with [graphs](https://
|
|
136
|
+
Another example with [graphs](https://docs.arangodb.com/stable/graphs/):
|
|
134
137
|
|
|
135
138
|
```python
|
|
136
139
|
from arango import ArangoClient
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
Python driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model
|
|
20
20
|
database natively supporting documents, graphs and search.
|
|
21
21
|
|
|
22
|
+
If you're interested in using asyncio, please check [python-arango-async](https://github.com/arangodb/python-arango-async).
|
|
23
|
+
|
|
22
24
|
## Requirements
|
|
23
25
|
|
|
24
26
|
- ArangoDB version 3.11+
|
|
@@ -65,7 +67,7 @@ cursor = db.aql.execute("FOR doc IN students RETURN doc")
|
|
|
65
67
|
student_names = [document["name"] for document in cursor]
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
Another example with [graphs](https://
|
|
70
|
+
Another example with [graphs](https://docs.arangodb.com/stable/graphs/):
|
|
69
71
|
|
|
70
72
|
```python
|
|
71
73
|
from arango import ArangoClient
|
|
@@ -566,15 +566,31 @@ class Collection(ApiGroup):
|
|
|
566
566
|
|
|
567
567
|
return self._execute(request, response_handler)
|
|
568
568
|
|
|
569
|
-
def truncate(
|
|
569
|
+
def truncate(
|
|
570
|
+
self,
|
|
571
|
+
sync: Optional[bool] = None,
|
|
572
|
+
compact: Optional[bool] = None,
|
|
573
|
+
) -> Result[bool]:
|
|
570
574
|
"""Delete all documents in the collection.
|
|
571
575
|
|
|
576
|
+
:param sync: Block until deletion operation is synchronized to disk.
|
|
577
|
+
:type sync: bool | None
|
|
578
|
+
:param compact: Whether to compact the collection after truncation.
|
|
579
|
+
:type compact: bool | None
|
|
572
580
|
:return: True if collection was truncated successfully.
|
|
573
581
|
:rtype: bool
|
|
574
582
|
:raise arango.exceptions.CollectionTruncateError: If operation fails.
|
|
575
583
|
"""
|
|
584
|
+
params: Json = {}
|
|
585
|
+
if sync is not None:
|
|
586
|
+
params["waitForSync"] = sync
|
|
587
|
+
if compact is not None:
|
|
588
|
+
params["compact"] = compact
|
|
589
|
+
|
|
576
590
|
request = Request(
|
|
577
|
-
method="put",
|
|
591
|
+
method="put",
|
|
592
|
+
endpoint=f"/_api/collection/{self.name}/truncate",
|
|
593
|
+
params=params,
|
|
578
594
|
)
|
|
579
595
|
|
|
580
596
|
def response_handler(resp: Response) -> bool:
|
|
@@ -1736,6 +1752,7 @@ class Collection(ApiGroup):
|
|
|
1736
1752
|
merge: Optional[bool] = None,
|
|
1737
1753
|
refill_index_caches: Optional[bool] = None,
|
|
1738
1754
|
version_attribute: Optional[str] = None,
|
|
1755
|
+
raise_on_document_error: bool = False,
|
|
1739
1756
|
) -> Result[Union[bool, List[Union[Json, ArangoServerError]]]]:
|
|
1740
1757
|
"""Insert multiple documents.
|
|
1741
1758
|
|
|
@@ -1745,15 +1762,8 @@ class Collection(ApiGroup):
|
|
|
1745
1762
|
returned as an object in the result list. It is up to you to
|
|
1746
1763
|
inspect the list to determine which documents were inserted
|
|
1747
1764
|
successfully (returns document metadata) and which were not
|
|
1748
|
-
(returns exception object).
|
|
1749
|
-
|
|
1750
|
-
.. note::
|
|
1751
|
-
|
|
1752
|
-
In edge/vertex collections, this method does NOT provide the
|
|
1753
|
-
transactional guarantees and validations that single insert
|
|
1754
|
-
operation does for graphs. If these properties are required, see
|
|
1755
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
1756
|
-
for an alternative approach.
|
|
1765
|
+
(returns exception object). Alternatively, you can rely on
|
|
1766
|
+
setting **raise_on_document_error** to True (defaults to False).
|
|
1757
1767
|
|
|
1758
1768
|
:param documents: List of new documents to insert. If they contain the
|
|
1759
1769
|
"_key" or "_id" fields, the values are used as the keys of the new
|
|
@@ -1793,6 +1803,11 @@ class Collection(ApiGroup):
|
|
|
1793
1803
|
:param version_attribute: support for simple external versioning to
|
|
1794
1804
|
document operations.
|
|
1795
1805
|
:type version_attribute: str
|
|
1806
|
+
:param raise_on_document_error: Whether to raise if a DocumentRevisionError
|
|
1807
|
+
or a DocumentInsertError is encountered on an individual document,
|
|
1808
|
+
as opposed to returning the error as an object in the result list.
|
|
1809
|
+
Defaults to False.
|
|
1810
|
+
:type raise_on_document_error: bool
|
|
1796
1811
|
:return: List of document metadata (e.g. document keys, revisions) and
|
|
1797
1812
|
any exception, or True if parameter **silent** was set to True.
|
|
1798
1813
|
:rtype: [dict | ArangoServerError] | bool
|
|
@@ -1845,7 +1860,12 @@ class Collection(ApiGroup):
|
|
|
1845
1860
|
results.append(body)
|
|
1846
1861
|
else:
|
|
1847
1862
|
sub_resp = self._conn.prep_bulk_err_response(resp, body)
|
|
1848
|
-
|
|
1863
|
+
error = DocumentInsertError(sub_resp, request)
|
|
1864
|
+
|
|
1865
|
+
if raise_on_document_error:
|
|
1866
|
+
raise error
|
|
1867
|
+
|
|
1868
|
+
results.append(error)
|
|
1849
1869
|
|
|
1850
1870
|
return results
|
|
1851
1871
|
|
|
@@ -1876,14 +1896,6 @@ class Collection(ApiGroup):
|
|
|
1876
1896
|
(returns exception object). Alternatively, you can rely on
|
|
1877
1897
|
setting **raise_on_document_error** to True (defaults to False).
|
|
1878
1898
|
|
|
1879
|
-
.. note::
|
|
1880
|
-
|
|
1881
|
-
In edge/vertex collections, this method does NOT provide the
|
|
1882
|
-
transactional guarantees and validations that single update
|
|
1883
|
-
operation does for graphs. If these properties are required, see
|
|
1884
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
1885
|
-
for an alternative approach.
|
|
1886
|
-
|
|
1887
1899
|
:param documents: Partial or full documents with the updated values.
|
|
1888
1900
|
They must contain the "_id" or "_key" fields.
|
|
1889
1901
|
:type documents: [dict]
|
|
@@ -1995,14 +2007,6 @@ class Collection(ApiGroup):
|
|
|
1995
2007
|
) -> Result[int]:
|
|
1996
2008
|
"""Update matching documents.
|
|
1997
2009
|
|
|
1998
|
-
.. note::
|
|
1999
|
-
|
|
2000
|
-
In edge/vertex collections, this method does NOT provide the
|
|
2001
|
-
transactional guarantees and validations that single update
|
|
2002
|
-
operation does for graphs. If these properties are required, see
|
|
2003
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
2004
|
-
for an alternative approach.
|
|
2005
|
-
|
|
2006
2010
|
:param filters: Document filters.
|
|
2007
2011
|
:type filters: dict
|
|
2008
2012
|
:param body: Full or partial document body with the updates.
|
|
@@ -2085,14 +2089,6 @@ class Collection(ApiGroup):
|
|
|
2085
2089
|
successfully (returns document metadata) and which were not
|
|
2086
2090
|
(returns exception object).
|
|
2087
2091
|
|
|
2088
|
-
.. note::
|
|
2089
|
-
|
|
2090
|
-
In edge/vertex collections, this method does NOT provide the
|
|
2091
|
-
transactional guarantees and validations that single replace
|
|
2092
|
-
operation does for graphs. If these properties are required, see
|
|
2093
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
2094
|
-
for an alternative approach.
|
|
2095
|
-
|
|
2096
2092
|
:param documents: New documents to replace the old ones with. They must
|
|
2097
2093
|
contain the "_id" or "_key" fields. Edge documents must also have
|
|
2098
2094
|
"_from" and "_to" fields.
|
|
@@ -2187,14 +2183,6 @@ class Collection(ApiGroup):
|
|
|
2187
2183
|
) -> Result[int]:
|
|
2188
2184
|
"""Replace matching documents.
|
|
2189
2185
|
|
|
2190
|
-
.. note::
|
|
2191
|
-
|
|
2192
|
-
In edge/vertex collections, this method does NOT provide the
|
|
2193
|
-
transactional guarantees and validations that single replace
|
|
2194
|
-
operation does for graphs. If these properties are required, see
|
|
2195
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
2196
|
-
for an alternative approach.
|
|
2197
|
-
|
|
2198
2186
|
:param filters: Document filters.
|
|
2199
2187
|
:type filters: dict
|
|
2200
2188
|
:param body: New document body.
|
|
@@ -2252,6 +2240,7 @@ class Collection(ApiGroup):
|
|
|
2252
2240
|
sync: Optional[bool] = None,
|
|
2253
2241
|
silent: bool = False,
|
|
2254
2242
|
refill_index_caches: Optional[bool] = None,
|
|
2243
|
+
raise_on_document_error: bool = False,
|
|
2255
2244
|
) -> Result[Union[bool, List[Union[Json, ArangoServerError]]]]:
|
|
2256
2245
|
"""Delete multiple documents.
|
|
2257
2246
|
|
|
@@ -2263,14 +2252,6 @@ class Collection(ApiGroup):
|
|
|
2263
2252
|
successfully (returns document metadata) and which were not
|
|
2264
2253
|
(returns exception object).
|
|
2265
2254
|
|
|
2266
|
-
.. note::
|
|
2267
|
-
|
|
2268
|
-
In edge/vertex collections, this method does NOT provide the
|
|
2269
|
-
transactional guarantees and validations that single delete
|
|
2270
|
-
operation does for graphs. If these properties are required, see
|
|
2271
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
2272
|
-
for an alternative approach.
|
|
2273
|
-
|
|
2274
2255
|
:param documents: Document IDs, keys or bodies. Document bodies must
|
|
2275
2256
|
contain the "_id" or "_key" fields.
|
|
2276
2257
|
:type documents: [str | dict]
|
|
@@ -2288,6 +2269,11 @@ class Collection(ApiGroup):
|
|
|
2288
2269
|
index caches if document operations affect the edge index or
|
|
2289
2270
|
cache-enabled persistent indexes.
|
|
2290
2271
|
:type refill_index_caches: bool | None
|
|
2272
|
+
:param raise_on_document_error: Whether to raise if a DocumentRevisionError
|
|
2273
|
+
or a DocumentDeleteError is encountered on an individual document,
|
|
2274
|
+
as opposed to returning the error as an object in the result list.
|
|
2275
|
+
Defaults to False.
|
|
2276
|
+
:type raise_on_document_error: bool
|
|
2291
2277
|
:return: List of document metadata (e.g. document keys, revisions) and
|
|
2292
2278
|
any exceptions, or True if parameter **silent** was set to True.
|
|
2293
2279
|
:rtype: [dict | ArangoServerError] | bool
|
|
@@ -2339,6 +2325,10 @@ class Collection(ApiGroup):
|
|
|
2339
2325
|
error = DocumentRevisionError(sub_resp, request)
|
|
2340
2326
|
else:
|
|
2341
2327
|
error = DocumentDeleteError(sub_resp, request)
|
|
2328
|
+
|
|
2329
|
+
if raise_on_document_error:
|
|
2330
|
+
raise error
|
|
2331
|
+
|
|
2342
2332
|
results.append(error)
|
|
2343
2333
|
|
|
2344
2334
|
return results
|
|
@@ -2354,14 +2344,6 @@ class Collection(ApiGroup):
|
|
|
2354
2344
|
) -> Result[int]:
|
|
2355
2345
|
"""Delete matching documents.
|
|
2356
2346
|
|
|
2357
|
-
.. note::
|
|
2358
|
-
|
|
2359
|
-
In edge/vertex collections, this method does NOT provide the
|
|
2360
|
-
transactional guarantees and validations that single delete
|
|
2361
|
-
operation does for graphs. If these properties are required, see
|
|
2362
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
2363
|
-
for an alternative approach.
|
|
2364
|
-
|
|
2365
2347
|
:param filters: Document filters.
|
|
2366
2348
|
:type filters: dict
|
|
2367
2349
|
:param limit: Max number of documents to delete. If the limit is lower
|
|
@@ -2428,14 +2410,6 @@ class Collection(ApiGroup):
|
|
|
2428
2410
|
This method is faster than :func:`arango.collection.Collection.insert_many`
|
|
2429
2411
|
but does not return as many details.
|
|
2430
2412
|
|
|
2431
|
-
.. note::
|
|
2432
|
-
|
|
2433
|
-
In edge/vertex collections, this method does NOT provide the
|
|
2434
|
-
transactional guarantees and validations that single insert
|
|
2435
|
-
operation does for graphs. If these properties are required, see
|
|
2436
|
-
:func:`arango.database.StandardDatabase.begin_batch_execution`
|
|
2437
|
-
for an alternative approach.
|
|
2438
|
-
|
|
2439
2413
|
:param documents: List of new documents to insert. If they contain the
|
|
2440
2414
|
"_key" or "_id" fields, the values are used as the keys of the new
|
|
2441
2415
|
documents (auto-generated otherwise). Any "_rev" field is ignored.
|
|
@@ -2757,7 +2731,6 @@ class StandardCollection(Collection):
|
|
|
2757
2731
|
"returnNew": return_new,
|
|
2758
2732
|
"returnOld": return_old,
|
|
2759
2733
|
"ignoreRevs": not check_rev,
|
|
2760
|
-
"overwrite": not check_rev,
|
|
2761
2734
|
"silent": silent,
|
|
2762
2735
|
}
|
|
2763
2736
|
if sync is not None:
|
|
@@ -3035,9 +3008,8 @@ class VertexCollection(Collection):
|
|
|
3035
3008
|
self,
|
|
3036
3009
|
vertex: Json,
|
|
3037
3010
|
sync: Optional[bool] = None,
|
|
3038
|
-
silent: bool = False,
|
|
3039
3011
|
return_new: bool = False,
|
|
3040
|
-
) -> Result[
|
|
3012
|
+
) -> Result[Json]:
|
|
3041
3013
|
"""Insert a new vertex document.
|
|
3042
3014
|
|
|
3043
3015
|
:param vertex: New vertex document to insert. If it has "_key" or "_id"
|
|
@@ -3046,20 +3018,16 @@ class VertexCollection(Collection):
|
|
|
3046
3018
|
:type vertex: dict
|
|
3047
3019
|
:param sync: Block until operation is synchronized to disk.
|
|
3048
3020
|
:type sync: bool | None
|
|
3049
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3050
|
-
can be used to save resources.
|
|
3051
|
-
:type silent: bool
|
|
3052
3021
|
:param return_new: Include body of the new document in the returned
|
|
3053
3022
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3054
3023
|
:type return_new: bool
|
|
3055
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3056
|
-
|
|
3057
|
-
:rtype: bool | dict
|
|
3024
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3025
|
+
:rtype: dict
|
|
3058
3026
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
3059
3027
|
"""
|
|
3060
3028
|
vertex = self._ensure_key_from_id(vertex)
|
|
3061
3029
|
|
|
3062
|
-
params: Params = {"
|
|
3030
|
+
params: Params = {"returnNew": return_new}
|
|
3063
3031
|
if sync is not None:
|
|
3064
3032
|
params["waitForSync"] = sync
|
|
3065
3033
|
|
|
@@ -3071,11 +3039,9 @@ class VertexCollection(Collection):
|
|
|
3071
3039
|
write=self.name,
|
|
3072
3040
|
)
|
|
3073
3041
|
|
|
3074
|
-
def response_handler(resp: Response) ->
|
|
3042
|
+
def response_handler(resp: Response) -> Json:
|
|
3075
3043
|
if not resp.is_success:
|
|
3076
3044
|
raise DocumentInsertError(resp, request)
|
|
3077
|
-
if silent:
|
|
3078
|
-
return True
|
|
3079
3045
|
return format_vertex(resp.body)
|
|
3080
3046
|
|
|
3081
3047
|
return self._execute(request, response_handler)
|
|
@@ -3086,10 +3052,9 @@ class VertexCollection(Collection):
|
|
|
3086
3052
|
check_rev: bool = True,
|
|
3087
3053
|
keep_none: bool = True,
|
|
3088
3054
|
sync: Optional[bool] = None,
|
|
3089
|
-
silent: bool = False,
|
|
3090
3055
|
return_old: bool = False,
|
|
3091
3056
|
return_new: bool = False,
|
|
3092
|
-
) -> Result[
|
|
3057
|
+
) -> Result[Json]:
|
|
3093
3058
|
"""Update a vertex document.
|
|
3094
3059
|
|
|
3095
3060
|
:param vertex: Partial or full vertex document with updated values. It
|
|
@@ -3103,18 +3068,14 @@ class VertexCollection(Collection):
|
|
|
3103
3068
|
:type keep_none: bool | None
|
|
3104
3069
|
:param sync: Block until operation is synchronized to disk.
|
|
3105
3070
|
:type sync: bool | None
|
|
3106
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3107
|
-
can be used to save resources.
|
|
3108
|
-
:type silent: bool
|
|
3109
3071
|
:param return_old: Include body of the old document in the returned
|
|
3110
3072
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3111
3073
|
:type return_old: bool
|
|
3112
3074
|
:param return_new: Include body of the new document in the returned
|
|
3113
3075
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3114
3076
|
:type return_new: bool
|
|
3115
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3116
|
-
|
|
3117
|
-
:rtype: bool | dict
|
|
3077
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3078
|
+
:rtype: dict
|
|
3118
3079
|
:raise arango.exceptions.DocumentUpdateError: If update fails.
|
|
3119
3080
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3120
3081
|
"""
|
|
@@ -3123,7 +3084,6 @@ class VertexCollection(Collection):
|
|
|
3123
3084
|
params: Params = {
|
|
3124
3085
|
"keepNull": keep_none,
|
|
3125
3086
|
"overwrite": not check_rev,
|
|
3126
|
-
"silent": silent,
|
|
3127
3087
|
"returnNew": return_new,
|
|
3128
3088
|
"returnOld": return_old,
|
|
3129
3089
|
}
|
|
@@ -3139,13 +3099,11 @@ class VertexCollection(Collection):
|
|
|
3139
3099
|
write=self.name,
|
|
3140
3100
|
)
|
|
3141
3101
|
|
|
3142
|
-
def response_handler(resp: Response) ->
|
|
3102
|
+
def response_handler(resp: Response) -> Json:
|
|
3143
3103
|
if resp.status_code == 412: # pragma: no cover
|
|
3144
3104
|
raise DocumentRevisionError(resp, request)
|
|
3145
3105
|
elif not resp.is_success:
|
|
3146
3106
|
raise DocumentUpdateError(resp, request)
|
|
3147
|
-
if silent is True:
|
|
3148
|
-
return True
|
|
3149
3107
|
return format_vertex(resp.body)
|
|
3150
3108
|
|
|
3151
3109
|
return self._execute(request, response_handler)
|
|
@@ -3155,10 +3113,9 @@ class VertexCollection(Collection):
|
|
|
3155
3113
|
vertex: Json,
|
|
3156
3114
|
check_rev: bool = True,
|
|
3157
3115
|
sync: Optional[bool] = None,
|
|
3158
|
-
silent: bool = False,
|
|
3159
3116
|
return_old: bool = False,
|
|
3160
3117
|
return_new: bool = False,
|
|
3161
|
-
) -> Result[
|
|
3118
|
+
) -> Result[Json]:
|
|
3162
3119
|
"""Replace a vertex document.
|
|
3163
3120
|
|
|
3164
3121
|
:param vertex: New vertex document to replace the old one with. It must
|
|
@@ -3169,25 +3126,20 @@ class VertexCollection(Collection):
|
|
|
3169
3126
|
:type check_rev: bool
|
|
3170
3127
|
:param sync: Block until operation is synchronized to disk.
|
|
3171
3128
|
:type sync: bool | None
|
|
3172
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3173
|
-
can be used to save resources.
|
|
3174
|
-
:type silent: bool
|
|
3175
3129
|
:param return_old: Include body of the old document in the returned
|
|
3176
3130
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3177
3131
|
:type return_old: bool
|
|
3178
3132
|
:param return_new: Include body of the new document in the returned
|
|
3179
3133
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3180
3134
|
:type return_new: bool
|
|
3181
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3182
|
-
|
|
3183
|
-
:rtype: bool | dict
|
|
3135
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3136
|
+
:rtype: dict
|
|
3184
3137
|
:raise arango.exceptions.DocumentReplaceError: If replace fails.
|
|
3185
3138
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3186
3139
|
"""
|
|
3187
3140
|
vertex_id, headers = self._prep_from_body(vertex, check_rev)
|
|
3188
3141
|
|
|
3189
3142
|
params: Params = {
|
|
3190
|
-
"silent": silent,
|
|
3191
3143
|
"returnNew": return_new,
|
|
3192
3144
|
"returnOld": return_old,
|
|
3193
3145
|
}
|
|
@@ -3203,13 +3155,11 @@ class VertexCollection(Collection):
|
|
|
3203
3155
|
write=self.name,
|
|
3204
3156
|
)
|
|
3205
3157
|
|
|
3206
|
-
def response_handler(resp: Response) ->
|
|
3158
|
+
def response_handler(resp: Response) -> Json:
|
|
3207
3159
|
if resp.status_code == 412: # pragma: no cover
|
|
3208
3160
|
raise DocumentRevisionError(resp, request)
|
|
3209
3161
|
elif not resp.is_success:
|
|
3210
3162
|
raise DocumentReplaceError(resp, request)
|
|
3211
|
-
if silent is True:
|
|
3212
|
-
return True
|
|
3213
3163
|
return format_vertex(resp.body)
|
|
3214
3164
|
|
|
3215
3165
|
return self._execute(request, response_handler)
|
|
@@ -3353,9 +3303,8 @@ class EdgeCollection(Collection):
|
|
|
3353
3303
|
self,
|
|
3354
3304
|
edge: Json,
|
|
3355
3305
|
sync: Optional[bool] = None,
|
|
3356
|
-
silent: bool = False,
|
|
3357
3306
|
return_new: bool = False,
|
|
3358
|
-
) -> Result[
|
|
3307
|
+
) -> Result[Json]:
|
|
3359
3308
|
"""Insert a new edge document.
|
|
3360
3309
|
|
|
3361
3310
|
:param edge: New edge document to insert. It must contain "_from" and
|
|
@@ -3365,20 +3314,16 @@ class EdgeCollection(Collection):
|
|
|
3365
3314
|
:type edge: dict
|
|
3366
3315
|
:param sync: Block until operation is synchronized to disk.
|
|
3367
3316
|
:type sync: bool | None
|
|
3368
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3369
|
-
can be used to save resources.
|
|
3370
|
-
:type silent: bool
|
|
3371
3317
|
:param return_new: Include body of the new document in the returned
|
|
3372
3318
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3373
3319
|
:type return_new: bool
|
|
3374
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3375
|
-
|
|
3376
|
-
:rtype: bool | dict
|
|
3320
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3321
|
+
:rtype: dict
|
|
3377
3322
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
3378
3323
|
"""
|
|
3379
3324
|
edge = self._ensure_key_from_id(edge)
|
|
3380
3325
|
|
|
3381
|
-
params: Params = {"
|
|
3326
|
+
params: Params = {"returnNew": return_new}
|
|
3382
3327
|
if sync is not None:
|
|
3383
3328
|
params["waitForSync"] = sync
|
|
3384
3329
|
|
|
@@ -3390,11 +3335,9 @@ class EdgeCollection(Collection):
|
|
|
3390
3335
|
write=self.name,
|
|
3391
3336
|
)
|
|
3392
3337
|
|
|
3393
|
-
def response_handler(resp: Response) ->
|
|
3338
|
+
def response_handler(resp: Response) -> Json:
|
|
3394
3339
|
if not resp.is_success:
|
|
3395
3340
|
raise DocumentInsertError(resp, request)
|
|
3396
|
-
if silent:
|
|
3397
|
-
return True
|
|
3398
3341
|
return format_edge(resp.body)
|
|
3399
3342
|
|
|
3400
3343
|
return self._execute(request, response_handler)
|
|
@@ -3405,10 +3348,9 @@ class EdgeCollection(Collection):
|
|
|
3405
3348
|
check_rev: bool = True,
|
|
3406
3349
|
keep_none: bool = True,
|
|
3407
3350
|
sync: Optional[bool] = None,
|
|
3408
|
-
silent: bool = False,
|
|
3409
3351
|
return_old: bool = False,
|
|
3410
3352
|
return_new: bool = False,
|
|
3411
|
-
) -> Result[
|
|
3353
|
+
) -> Result[Json]:
|
|
3412
3354
|
"""Update an edge document.
|
|
3413
3355
|
|
|
3414
3356
|
:param edge: Partial or full edge document with updated values. It must
|
|
@@ -3422,18 +3364,14 @@ class EdgeCollection(Collection):
|
|
|
3422
3364
|
:type keep_none: bool | None
|
|
3423
3365
|
:param sync: Block until operation is synchronized to disk.
|
|
3424
3366
|
:type sync: bool | None
|
|
3425
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3426
|
-
can be used to save resources.
|
|
3427
|
-
:type silent: bool
|
|
3428
3367
|
:param return_old: Include body of the old document in the returned
|
|
3429
3368
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3430
3369
|
:type return_old: bool
|
|
3431
3370
|
:param return_new: Include body of the new document in the returned
|
|
3432
3371
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3433
3372
|
:type return_new: bool
|
|
3434
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3435
|
-
|
|
3436
|
-
:rtype: bool | dict
|
|
3373
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3374
|
+
:rtype: dict
|
|
3437
3375
|
:raise arango.exceptions.DocumentUpdateError: If update fails.
|
|
3438
3376
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3439
3377
|
"""
|
|
@@ -3442,7 +3380,6 @@ class EdgeCollection(Collection):
|
|
|
3442
3380
|
params: Params = {
|
|
3443
3381
|
"keepNull": keep_none,
|
|
3444
3382
|
"overwrite": not check_rev,
|
|
3445
|
-
"silent": silent,
|
|
3446
3383
|
"returnNew": return_new,
|
|
3447
3384
|
"returnOld": return_old,
|
|
3448
3385
|
}
|
|
@@ -3458,13 +3395,11 @@ class EdgeCollection(Collection):
|
|
|
3458
3395
|
write=self.name,
|
|
3459
3396
|
)
|
|
3460
3397
|
|
|
3461
|
-
def response_handler(resp: Response) ->
|
|
3398
|
+
def response_handler(resp: Response) -> Json:
|
|
3462
3399
|
if resp.status_code == 412: # pragma: no cover
|
|
3463
3400
|
raise DocumentRevisionError(resp, request)
|
|
3464
3401
|
if not resp.is_success:
|
|
3465
3402
|
raise DocumentUpdateError(resp, request)
|
|
3466
|
-
if silent is True:
|
|
3467
|
-
return True
|
|
3468
3403
|
return format_edge(resp.body)
|
|
3469
3404
|
|
|
3470
3405
|
return self._execute(request, response_handler)
|
|
@@ -3474,10 +3409,9 @@ class EdgeCollection(Collection):
|
|
|
3474
3409
|
edge: Json,
|
|
3475
3410
|
check_rev: bool = True,
|
|
3476
3411
|
sync: Optional[bool] = None,
|
|
3477
|
-
silent: bool = False,
|
|
3478
3412
|
return_old: bool = False,
|
|
3479
3413
|
return_new: bool = False,
|
|
3480
|
-
) -> Result[
|
|
3414
|
+
) -> Result[Json]:
|
|
3481
3415
|
"""Replace an edge document.
|
|
3482
3416
|
|
|
3483
3417
|
:param edge: New edge document to replace the old one with. It must
|
|
@@ -3489,25 +3423,20 @@ class EdgeCollection(Collection):
|
|
|
3489
3423
|
:type check_rev: bool
|
|
3490
3424
|
:param sync: Block until operation is synchronized to disk.
|
|
3491
3425
|
:type sync: bool | None
|
|
3492
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3493
|
-
can be used to save resources.
|
|
3494
|
-
:type silent: bool
|
|
3495
3426
|
:param return_old: Include body of the old document in the returned
|
|
3496
3427
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3497
3428
|
:type return_old: bool
|
|
3498
3429
|
:param return_new: Include body of the new document in the returned
|
|
3499
3430
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3500
3431
|
:type return_new: bool
|
|
3501
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3502
|
-
|
|
3503
|
-
:rtype: bool | dict
|
|
3432
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3433
|
+
:rtype: dict
|
|
3504
3434
|
:raise arango.exceptions.DocumentReplaceError: If replace fails.
|
|
3505
3435
|
:raise arango.exceptions.DocumentRevisionError: If revisions mismatch.
|
|
3506
3436
|
"""
|
|
3507
3437
|
edge_id, headers = self._prep_from_body(edge, check_rev)
|
|
3508
3438
|
|
|
3509
3439
|
params: Params = {
|
|
3510
|
-
"silent": silent,
|
|
3511
3440
|
"returnNew": return_new,
|
|
3512
3441
|
"returnOld": return_old,
|
|
3513
3442
|
}
|
|
@@ -3523,13 +3452,11 @@ class EdgeCollection(Collection):
|
|
|
3523
3452
|
write=self.name,
|
|
3524
3453
|
)
|
|
3525
3454
|
|
|
3526
|
-
def response_handler(resp: Response) ->
|
|
3455
|
+
def response_handler(resp: Response) -> Json:
|
|
3527
3456
|
if resp.status_code == 412: # pragma: no cover
|
|
3528
3457
|
raise DocumentRevisionError(resp, request)
|
|
3529
3458
|
if not resp.is_success:
|
|
3530
3459
|
raise DocumentReplaceError(resp, request)
|
|
3531
|
-
if silent is True:
|
|
3532
|
-
return True
|
|
3533
3460
|
return format_edge(resp.body)
|
|
3534
3461
|
|
|
3535
3462
|
return self._execute(request, response_handler)
|
|
@@ -3602,9 +3529,8 @@ class EdgeCollection(Collection):
|
|
|
3602
3529
|
to_vertex: Union[str, Json],
|
|
3603
3530
|
data: Optional[Json] = None,
|
|
3604
3531
|
sync: Optional[bool] = None,
|
|
3605
|
-
silent: bool = False,
|
|
3606
3532
|
return_new: bool = False,
|
|
3607
|
-
) -> Result[
|
|
3533
|
+
) -> Result[Json]:
|
|
3608
3534
|
"""Insert a new edge document linking the given vertices.
|
|
3609
3535
|
|
|
3610
3536
|
:param from_vertex: "From" vertex document ID or body with "_id" field.
|
|
@@ -3617,21 +3543,17 @@ class EdgeCollection(Collection):
|
|
|
3617
3543
|
:type data: dict | None
|
|
3618
3544
|
:param sync: Block until operation is synchronized to disk.
|
|
3619
3545
|
:type sync: bool | None
|
|
3620
|
-
:param silent: If set to True, no document metadata is returned. This
|
|
3621
|
-
can be used to save resources.
|
|
3622
|
-
:type silent: bool
|
|
3623
3546
|
:param return_new: Include body of the new document in the returned
|
|
3624
3547
|
metadata. Ignored if parameter **silent** is set to True.
|
|
3625
3548
|
:type return_new: bool
|
|
3626
|
-
:return: Document metadata (e.g. document key, revision)
|
|
3627
|
-
|
|
3628
|
-
:rtype: bool | dict
|
|
3549
|
+
:return: Document metadata (e.g. document key, revision).
|
|
3550
|
+
:rtype: dict
|
|
3629
3551
|
:raise arango.exceptions.DocumentInsertError: If insert fails.
|
|
3630
3552
|
"""
|
|
3631
3553
|
edge = {"_from": get_doc_id(from_vertex), "_to": get_doc_id(to_vertex)}
|
|
3632
3554
|
if data is not None:
|
|
3633
3555
|
edge.update(self._ensure_key_from_id(data))
|
|
3634
|
-
return self.insert(edge, sync=sync,
|
|
3556
|
+
return self.insert(edge, sync=sync, return_new=return_new)
|
|
3635
3557
|
|
|
3636
3558
|
def edges(
|
|
3637
3559
|
self,
|