python-arango 8.3.2__py3-none-any.whl → 8.3.4__py3-none-any.whl
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.
- arango/aql.py +6 -0
- arango/cluster.py +5 -0
- arango/collection.py +43 -157
- arango/database.py +43 -2
- arango/foxx.py +4 -1
- arango/replication.py +50 -174
- arango/utils.py +47 -17
- arango/version.py +1 -1
- arango/wal.py +15 -3
- {python_arango-8.3.2.dist-info → python_arango-8.3.4.dist-info}/METADATA +2 -2
- {python_arango-8.3.2.dist-info → python_arango-8.3.4.dist-info}/RECORD +14 -14
- {python_arango-8.3.2.dist-info → python_arango-8.3.4.dist-info}/WHEEL +1 -1
- {python_arango-8.3.2.dist-info → python_arango-8.3.4.dist-info}/licenses/LICENSE +0 -0
- {python_arango-8.3.2.dist-info → python_arango-8.3.4.dist-info}/top_level.txt +0 -0
arango/aql.py
CHANGED
|
@@ -654,6 +654,8 @@ class AQL(ApiGroup):
|
|
|
654
654
|
def functions(self) -> Result[Jsons]:
|
|
655
655
|
"""List the AQL functions defined in the database.
|
|
656
656
|
|
|
657
|
+
.. warning:: AQL User Functions are no longer available in ArangoDB 4.0.
|
|
658
|
+
|
|
657
659
|
:return: AQL functions.
|
|
658
660
|
:rtype: [dict]
|
|
659
661
|
:raise arango.exceptions.AQLFunctionListError: If retrieval fails.
|
|
@@ -676,6 +678,8 @@ class AQL(ApiGroup):
|
|
|
676
678
|
def create_function(self, name: str, code: str) -> Result[Json]:
|
|
677
679
|
"""Create a new AQL function.
|
|
678
680
|
|
|
681
|
+
.. warning:: AQL User Functions are no longer available in ArangoDB 4.0.
|
|
682
|
+
|
|
679
683
|
:param name: AQL function name.
|
|
680
684
|
:type name: str
|
|
681
685
|
:param code: Function definition in Javascript.
|
|
@@ -703,6 +707,8 @@ class AQL(ApiGroup):
|
|
|
703
707
|
) -> Result[Union[bool, Json]]:
|
|
704
708
|
"""Delete an AQL function.
|
|
705
709
|
|
|
710
|
+
.. warning:: AQL User Functions are no longer available in ArangoDB 4.0.
|
|
711
|
+
|
|
706
712
|
:param name: AQL function name.
|
|
707
713
|
:type name: str
|
|
708
714
|
:param group: If set to True, value of parameter **name** is treated
|
arango/cluster.py
CHANGED
|
@@ -144,6 +144,11 @@ class Cluster(ApiGroup): # pragma: no cover
|
|
|
144
144
|
def server_statistics(self, server_id: str) -> Result[Json]:
|
|
145
145
|
"""Return the statistics for the given server.
|
|
146
146
|
|
|
147
|
+
.. warning::
|
|
148
|
+
DB Server Statistics are no longer available in ArangoDB 4.0.
|
|
149
|
+
Use :meth:`Database.metrics <arango.database.StandardDatabase.metrics>`
|
|
150
|
+
instead.
|
|
151
|
+
|
|
147
152
|
:param server_id: Server ID.
|
|
148
153
|
:type server_id: str
|
|
149
154
|
:return: Statistics for the given server.
|
arango/collection.py
CHANGED
|
@@ -542,7 +542,7 @@ class Collection(ApiGroup):
|
|
|
542
542
|
.. note::
|
|
543
543
|
The load function is deprecated from version 3.8.0 onwards and is a
|
|
544
544
|
no-op from version 3.9.0 onwards. It should no longer be used, as it
|
|
545
|
-
|
|
545
|
+
is removed from ArangoDB 4.0.
|
|
546
546
|
|
|
547
547
|
:return: True if collection was loaded successfully.
|
|
548
548
|
:rtype: bool
|
|
@@ -566,7 +566,7 @@ class Collection(ApiGroup):
|
|
|
566
566
|
.. note::
|
|
567
567
|
The unload function is deprecated from version 3.8.0 onwards and is a
|
|
568
568
|
no-op from version 3.9.0 onwards. It should no longer be used, as it
|
|
569
|
-
|
|
569
|
+
is removed from ArangoDB 4.0.
|
|
570
570
|
|
|
571
571
|
:return: True if collection was unloaded successfully.
|
|
572
572
|
:rtype: bool
|
|
@@ -816,14 +816,20 @@ class Collection(ApiGroup):
|
|
|
816
816
|
|
|
817
817
|
skip_val = skip if skip is not None else 0
|
|
818
818
|
limit_val = limit if limit is not None else "null"
|
|
819
|
+
filter_conditions, filter_bind_vars = build_filter_conditions(filters)
|
|
820
|
+
sort_expression, sort_bind_vars = build_sort_expression(sort)
|
|
819
821
|
query = f"""
|
|
820
822
|
FOR doc IN @@collection
|
|
821
|
-
{
|
|
823
|
+
{filter_conditions}
|
|
822
824
|
LIMIT {skip_val}, {limit_val}
|
|
823
|
-
{
|
|
825
|
+
{sort_expression}
|
|
824
826
|
RETURN doc
|
|
825
827
|
"""
|
|
826
|
-
bind_vars = {
|
|
828
|
+
bind_vars = {
|
|
829
|
+
"@collection": self.name,
|
|
830
|
+
**filter_bind_vars,
|
|
831
|
+
**sort_bind_vars,
|
|
832
|
+
}
|
|
827
833
|
|
|
828
834
|
request = Request(
|
|
829
835
|
method="post",
|
|
@@ -849,6 +855,8 @@ class Collection(ApiGroup):
|
|
|
849
855
|
) -> Result[Cursor]:
|
|
850
856
|
"""Return documents near a given coordinate.
|
|
851
857
|
|
|
858
|
+
.. warning:: This functionality is deprecated in ArangoDB 4.0.
|
|
859
|
+
|
|
852
860
|
Documents returned are sorted according to distance, with the nearest
|
|
853
861
|
document being the first. If there are documents of equal distance,
|
|
854
862
|
they are randomly chosen from the set until the limit is reached. A geo
|
|
@@ -866,6 +874,9 @@ class Collection(ApiGroup):
|
|
|
866
874
|
:rtype: arango.cursor.Cursor
|
|
867
875
|
:raises arango.exceptions.DocumentGetError: If retrieval fails.
|
|
868
876
|
"""
|
|
877
|
+
m = "find_near is deprecated in ArangoDB 4.0"
|
|
878
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
879
|
+
|
|
869
880
|
assert isinstance(latitude, Number), "latitude must be a number"
|
|
870
881
|
assert isinstance(longitude, Number), "longitude must be a number"
|
|
871
882
|
assert is_none_or_int(limit), "limit must be a non-negative int"
|
|
@@ -971,6 +982,8 @@ class Collection(ApiGroup):
|
|
|
971
982
|
) -> Result[Cursor]:
|
|
972
983
|
"""Return documents within a given radius around a coordinate.
|
|
973
984
|
|
|
985
|
+
.. warning:: This functionality is deprecated in ArangoDB 4.0.
|
|
986
|
+
|
|
974
987
|
A geo index must be defined in the collection to use this method.
|
|
975
988
|
|
|
976
989
|
:param latitude: Latitude.
|
|
@@ -988,6 +1001,9 @@ class Collection(ApiGroup):
|
|
|
988
1001
|
:rtype: arango.cursor.Cursor
|
|
989
1002
|
:raises arango.exceptions.DocumentGetError: If retrieval fails.
|
|
990
1003
|
"""
|
|
1004
|
+
m = "find_in_radius is deprecated in ArangoDB 4.0"
|
|
1005
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
1006
|
+
|
|
991
1007
|
assert isinstance(latitude, Number), "latitude must be a number"
|
|
992
1008
|
assert isinstance(longitude, Number), "longitude must be a number"
|
|
993
1009
|
assert isinstance(radius, Number), "radius must be a number"
|
|
@@ -1141,6 +1157,11 @@ class Collection(ApiGroup):
|
|
|
1141
1157
|
) -> Result[Cursor]:
|
|
1142
1158
|
"""Return documents that match the given fulltext query.
|
|
1143
1159
|
|
|
1160
|
+
.. warning::
|
|
1161
|
+
|
|
1162
|
+
Fulltext indexes are no longer supported and have been replaced
|
|
1163
|
+
by ArangoSearch (inverted indexes).
|
|
1164
|
+
|
|
1144
1165
|
:param field: Document field with fulltext index.
|
|
1145
1166
|
:type field: str
|
|
1146
1167
|
:param query: Fulltext query.
|
|
@@ -1335,112 +1356,6 @@ class Collection(ApiGroup):
|
|
|
1335
1356
|
|
|
1336
1357
|
return self._execute(request, response_handler)
|
|
1337
1358
|
|
|
1338
|
-
def add_hash_index(
|
|
1339
|
-
self,
|
|
1340
|
-
fields: Sequence[str],
|
|
1341
|
-
unique: Optional[bool] = None,
|
|
1342
|
-
sparse: Optional[bool] = None,
|
|
1343
|
-
deduplicate: Optional[bool] = None,
|
|
1344
|
-
name: Optional[str] = None,
|
|
1345
|
-
in_background: Optional[bool] = None,
|
|
1346
|
-
) -> Result[Json]:
|
|
1347
|
-
"""Create a new hash index.
|
|
1348
|
-
|
|
1349
|
-
.. warning::
|
|
1350
|
-
|
|
1351
|
-
The index types `hash` and `skiplist` are aliases for the persistent
|
|
1352
|
-
index type and should no longer be used to create new indexes. The
|
|
1353
|
-
aliases will be removed in a future version.
|
|
1354
|
-
|
|
1355
|
-
:param fields: Document fields to index.
|
|
1356
|
-
:type fields: [str]
|
|
1357
|
-
:param unique: Whether the index is unique.
|
|
1358
|
-
:type unique: bool | None
|
|
1359
|
-
:param sparse: If set to True, documents with None in the field
|
|
1360
|
-
are also indexed. If set to False, they are skipped.
|
|
1361
|
-
:type sparse: bool | None
|
|
1362
|
-
:param deduplicate: If set to True, inserting duplicate index values
|
|
1363
|
-
from the same document triggers unique constraint errors.
|
|
1364
|
-
:type deduplicate: bool | None
|
|
1365
|
-
:param name: Optional name for the index.
|
|
1366
|
-
:type name: str | None
|
|
1367
|
-
:param in_background: Do not hold the collection lock.
|
|
1368
|
-
:type in_background: bool | None
|
|
1369
|
-
:return: New index details.
|
|
1370
|
-
:rtype: dict
|
|
1371
|
-
:raise arango.exceptions.IndexCreateError: If create fails.
|
|
1372
|
-
"""
|
|
1373
|
-
m = "add_hash_index is deprecated. Using add_index with {'type': 'hash'} instead." # noqa: E501
|
|
1374
|
-
warn(m, DeprecationWarning, stacklevel=2)
|
|
1375
|
-
|
|
1376
|
-
data: Json = {"type": "hash", "fields": fields}
|
|
1377
|
-
|
|
1378
|
-
if unique is not None:
|
|
1379
|
-
data["unique"] = unique
|
|
1380
|
-
if sparse is not None:
|
|
1381
|
-
data["sparse"] = sparse
|
|
1382
|
-
if deduplicate is not None:
|
|
1383
|
-
data["deduplicate"] = deduplicate
|
|
1384
|
-
if name is not None:
|
|
1385
|
-
data["name"] = name
|
|
1386
|
-
if in_background is not None:
|
|
1387
|
-
data["inBackground"] = in_background
|
|
1388
|
-
|
|
1389
|
-
return self.add_index(data, formatter=True)
|
|
1390
|
-
|
|
1391
|
-
def add_skiplist_index(
|
|
1392
|
-
self,
|
|
1393
|
-
fields: Sequence[str],
|
|
1394
|
-
unique: Optional[bool] = None,
|
|
1395
|
-
sparse: Optional[bool] = None,
|
|
1396
|
-
deduplicate: Optional[bool] = None,
|
|
1397
|
-
name: Optional[str] = None,
|
|
1398
|
-
in_background: Optional[bool] = None,
|
|
1399
|
-
) -> Result[Json]:
|
|
1400
|
-
"""Create a new skiplist index.
|
|
1401
|
-
|
|
1402
|
-
.. warning::
|
|
1403
|
-
|
|
1404
|
-
The index types `hash` and `skiplist` are aliases for the persistent
|
|
1405
|
-
index type and should no longer be used to create new indexes. The
|
|
1406
|
-
aliases will be removed in a future version.
|
|
1407
|
-
|
|
1408
|
-
:param fields: Document fields to index.
|
|
1409
|
-
:type fields: [str]
|
|
1410
|
-
:param unique: Whether the index is unique.
|
|
1411
|
-
:type unique: bool | None
|
|
1412
|
-
:param sparse: If set to True, documents with None in the field
|
|
1413
|
-
are also indexed. If set to False, they are skipped.
|
|
1414
|
-
:type sparse: bool | None
|
|
1415
|
-
:param deduplicate: If set to True, inserting duplicate index values
|
|
1416
|
-
from the same document triggers unique constraint errors.
|
|
1417
|
-
:type deduplicate: bool | None
|
|
1418
|
-
:param name: Optional name for the index.
|
|
1419
|
-
:type name: str | None
|
|
1420
|
-
:param in_background: Do not hold the collection lock.
|
|
1421
|
-
:type in_background: bool | None
|
|
1422
|
-
:return: New index details.
|
|
1423
|
-
:rtype: dict
|
|
1424
|
-
:raise arango.exceptions.IndexCreateError: If create fails.
|
|
1425
|
-
"""
|
|
1426
|
-
m = "add_skiplist_index is deprecated. Using add_index with {'type': 'skiplist'} instead." # noqa: E501
|
|
1427
|
-
warn(m, DeprecationWarning, stacklevel=2)
|
|
1428
|
-
|
|
1429
|
-
data: Json = {"type": "skiplist", "fields": fields}
|
|
1430
|
-
|
|
1431
|
-
if unique is not None:
|
|
1432
|
-
data["unique"] = unique
|
|
1433
|
-
if sparse is not None:
|
|
1434
|
-
data["sparse"] = sparse
|
|
1435
|
-
if deduplicate is not None:
|
|
1436
|
-
data["deduplicate"] = deduplicate
|
|
1437
|
-
if name is not None:
|
|
1438
|
-
data["name"] = name
|
|
1439
|
-
if in_background is not None:
|
|
1440
|
-
data["inBackground"] = in_background
|
|
1441
|
-
|
|
1442
|
-
return self.add_index(data, formatter=True)
|
|
1443
|
-
|
|
1444
1359
|
def add_geo_index(
|
|
1445
1360
|
self,
|
|
1446
1361
|
fields: Fields,
|
|
@@ -1487,45 +1402,6 @@ class Collection(ApiGroup):
|
|
|
1487
1402
|
|
|
1488
1403
|
return self.add_index(data, formatter=True)
|
|
1489
1404
|
|
|
1490
|
-
def add_fulltext_index(
|
|
1491
|
-
self,
|
|
1492
|
-
fields: Sequence[str],
|
|
1493
|
-
min_length: Optional[int] = None,
|
|
1494
|
-
name: Optional[str] = None,
|
|
1495
|
-
in_background: Optional[bool] = None,
|
|
1496
|
-
) -> Result[Json]:
|
|
1497
|
-
"""Create a new fulltext index.
|
|
1498
|
-
|
|
1499
|
-
.. warning::
|
|
1500
|
-
This method is deprecated since ArangoDB 3.10 and will be removed
|
|
1501
|
-
in a future version of the driver.
|
|
1502
|
-
|
|
1503
|
-
:param fields: Document fields to index.
|
|
1504
|
-
:type fields: [str]
|
|
1505
|
-
:param min_length: Minimum number of characters to index.
|
|
1506
|
-
:type min_length: int | None
|
|
1507
|
-
:param name: Optional name for the index.
|
|
1508
|
-
:type name: str | None
|
|
1509
|
-
:param in_background: Do not hold the collection lock.
|
|
1510
|
-
:type in_background: bool | None
|
|
1511
|
-
:return: New index details.
|
|
1512
|
-
:rtype: dict
|
|
1513
|
-
:raise arango.exceptions.IndexCreateError: If create fails.
|
|
1514
|
-
"""
|
|
1515
|
-
m = "add_fulltext_index is deprecated. Using add_index with {'type': 'fulltext'} instead." # noqa: E501
|
|
1516
|
-
warn(m, DeprecationWarning, stacklevel=2)
|
|
1517
|
-
|
|
1518
|
-
data: Json = {"type": "fulltext", "fields": fields}
|
|
1519
|
-
|
|
1520
|
-
if min_length is not None:
|
|
1521
|
-
data["minLength"] = min_length
|
|
1522
|
-
if name is not None:
|
|
1523
|
-
data["name"] = name
|
|
1524
|
-
if in_background is not None:
|
|
1525
|
-
data["inBackground"] = in_background
|
|
1526
|
-
|
|
1527
|
-
return self.add_index(data, formatter=True)
|
|
1528
|
-
|
|
1529
1405
|
def add_persistent_index(
|
|
1530
1406
|
self,
|
|
1531
1407
|
fields: Sequence[str],
|
|
@@ -1790,7 +1666,8 @@ class Collection(ApiGroup):
|
|
|
1790
1666
|
can be used to save resources.
|
|
1791
1667
|
:type silent: bool
|
|
1792
1668
|
:param overwrite: If set to True, operation does not fail on duplicate
|
|
1793
|
-
keys and the existing documents are replaced.
|
|
1669
|
+
keys and the existing documents are replaced. **Removed** in ArangoDB
|
|
1670
|
+
v4.0.0. Use overwrite_mode instead.
|
|
1794
1671
|
:type overwrite: bool
|
|
1795
1672
|
:param return_old: Include body of the old documents if replaced.
|
|
1796
1673
|
Applies only when value of **overwrite** is set to True.
|
|
@@ -2049,9 +1926,10 @@ class Collection(ApiGroup):
|
|
|
2049
1926
|
# then the collection’s default waitForSync behavior is applied.
|
|
2050
1927
|
sync_val = f", waitForSync: {sync}" if sync is not None else ""
|
|
2051
1928
|
|
|
1929
|
+
filter_conditions, filter_bind_vars = build_filter_conditions(filters)
|
|
2052
1930
|
query = f"""
|
|
2053
1931
|
FOR doc IN @@collection
|
|
2054
|
-
{
|
|
1932
|
+
{filter_conditions}
|
|
2055
1933
|
{f"LIMIT {limit}" if limit is not None else ""}
|
|
2056
1934
|
UPDATE doc WITH @body IN @@collection
|
|
2057
1935
|
OPTIONS {{ keepNull: @keep_none, mergeObjects: @merge {sync_val} }}
|
|
@@ -2062,6 +1940,7 @@ class Collection(ApiGroup):
|
|
|
2062
1940
|
"body": body,
|
|
2063
1941
|
"keep_none": keep_none,
|
|
2064
1942
|
"merge": merge,
|
|
1943
|
+
**filter_bind_vars,
|
|
2065
1944
|
}
|
|
2066
1945
|
|
|
2067
1946
|
request = Request(
|
|
@@ -2218,15 +2097,20 @@ class Collection(ApiGroup):
|
|
|
2218
2097
|
# then the collection’s default waitForSync behavior is applied.
|
|
2219
2098
|
sync_val = f"waitForSync: {sync}" if sync is not None else ""
|
|
2220
2099
|
|
|
2100
|
+
filter_conditions, filter_bind_vars = build_filter_conditions(filters)
|
|
2221
2101
|
query = f"""
|
|
2222
2102
|
FOR doc IN @@collection
|
|
2223
|
-
{
|
|
2103
|
+
{filter_conditions}
|
|
2224
2104
|
{f"LIMIT {limit}" if limit is not None else ""}
|
|
2225
2105
|
REPLACE doc WITH @body IN @@collection
|
|
2226
2106
|
{f"OPTIONS {{ {sync_val} }}" if sync_val else ""}
|
|
2227
2107
|
""" # noqa: E201 E202
|
|
2228
2108
|
|
|
2229
|
-
bind_vars = {
|
|
2109
|
+
bind_vars = {
|
|
2110
|
+
"@collection": self.name,
|
|
2111
|
+
"body": body,
|
|
2112
|
+
**filter_bind_vars,
|
|
2113
|
+
}
|
|
2230
2114
|
|
|
2231
2115
|
request = Request(
|
|
2232
2116
|
method="post",
|
|
@@ -2377,15 +2261,16 @@ class Collection(ApiGroup):
|
|
|
2377
2261
|
# then the collection’s default waitForSync behavior is applied.
|
|
2378
2262
|
sync_val = f"waitForSync: {sync}" if sync is not None else ""
|
|
2379
2263
|
|
|
2264
|
+
filter_conditions, filter_bind_vars = build_filter_conditions(filters)
|
|
2380
2265
|
query = f"""
|
|
2381
2266
|
FOR doc IN @@collection
|
|
2382
|
-
{
|
|
2267
|
+
{filter_conditions}
|
|
2383
2268
|
{f"LIMIT {limit}" if limit is not None else ""}
|
|
2384
2269
|
REMOVE doc IN @@collection
|
|
2385
2270
|
{f"OPTIONS {{ {sync_val} }}" if sync_val else ""}
|
|
2386
2271
|
""" # noqa: E201 E202
|
|
2387
2272
|
|
|
2388
|
-
bind_vars = {"@collection": self.name}
|
|
2273
|
+
bind_vars = {"@collection": self.name, **filter_bind_vars}
|
|
2389
2274
|
|
|
2390
2275
|
request = Request(
|
|
2391
2276
|
method="post",
|
|
@@ -2611,7 +2496,8 @@ class StandardCollection(Collection):
|
|
|
2611
2496
|
can be used to save resources.
|
|
2612
2497
|
:type silent: bool
|
|
2613
2498
|
:param overwrite: If set to True, operation does not fail on duplicate
|
|
2614
|
-
key and existing document is overwritten (replace-insert).
|
|
2499
|
+
key and existing document is overwritten (replace-insert). **Removed**
|
|
2500
|
+
in ArangoDB v4.0.0. Use overwrite_mode instead.
|
|
2615
2501
|
:type overwrite: bool
|
|
2616
2502
|
:param return_old: Include body of the old document if overwritten.
|
|
2617
2503
|
Ignored if parameter **silent** is set to True.
|
arango/database.py
CHANGED
|
@@ -181,6 +181,8 @@ class Database(ApiGroup):
|
|
|
181
181
|
def foxx(self) -> Foxx:
|
|
182
182
|
"""Return Foxx API wrapper.
|
|
183
183
|
|
|
184
|
+
.. warning:: Foxx microservice features are no longer available in ArangoDB 4.0.
|
|
185
|
+
|
|
184
186
|
:return: Foxx API wrapper.
|
|
185
187
|
:rtype: arango.foxx.Foxx
|
|
186
188
|
"""
|
|
@@ -244,6 +246,10 @@ class Database(ApiGroup):
|
|
|
244
246
|
def execute(self, command: str) -> Result[Any]:
|
|
245
247
|
"""Execute raw Javascript command on the server.
|
|
246
248
|
|
|
249
|
+
.. warning::
|
|
250
|
+
|
|
251
|
+
Javascript command execution is no longer available in ArangoDB 4.0.
|
|
252
|
+
|
|
247
253
|
Executes the JavaScript code in the body on the server as
|
|
248
254
|
the body of a function with no arguments. If you have a
|
|
249
255
|
return statement then the return value you produce will be returned
|
|
@@ -569,10 +575,15 @@ class Database(ApiGroup):
|
|
|
569
575
|
def required_db_version(self) -> Result[str]:
|
|
570
576
|
"""Return required version of target database.
|
|
571
577
|
|
|
578
|
+
.. warning:: Required version endpoint is no longer available in ArangoDB 4.0.
|
|
579
|
+
|
|
572
580
|
:return: Required version of target database.
|
|
573
581
|
:rtype: str
|
|
574
582
|
:raise arango.exceptions.ServerRequiredDBVersionError: If retrieval fails.
|
|
575
583
|
"""
|
|
584
|
+
m = "target-version is removed in ArangoDB 4.0"
|
|
585
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
586
|
+
|
|
576
587
|
request = Request(method="get", endpoint="/_admin/database/target-version")
|
|
577
588
|
|
|
578
589
|
def response_handler(resp: Response) -> str:
|
|
@@ -601,6 +612,11 @@ class Database(ApiGroup):
|
|
|
601
612
|
def statistics(self, description: bool = False) -> Result[Json]:
|
|
602
613
|
"""Return server statistics.
|
|
603
614
|
|
|
615
|
+
.. warning::
|
|
616
|
+
Server Statistics are no longer available in ArangoDB 4.0.
|
|
617
|
+
Use :meth:`Database.metrics <arango.database.StandardDatabase.metrics>`
|
|
618
|
+
instead.
|
|
619
|
+
|
|
604
620
|
:return: Server statistics.
|
|
605
621
|
:rtype: dict
|
|
606
622
|
:raise arango.exceptions.ServerStatisticsError: If retrieval fails.
|
|
@@ -707,6 +723,8 @@ class Database(ApiGroup):
|
|
|
707
723
|
"""Return details of the last request (e.g. headers, payload),
|
|
708
724
|
or echo the given request body.
|
|
709
725
|
|
|
726
|
+
.. warning:: Request echoing is no longer available in ArangoDB 4.0.
|
|
727
|
+
|
|
710
728
|
:param body: The body of the request. Can be of any type
|
|
711
729
|
and is simply forwarded. If not set, the details of the last
|
|
712
730
|
request are returned.
|
|
@@ -1095,6 +1113,8 @@ class Database(ApiGroup):
|
|
|
1095
1113
|
def reload_routing(self) -> Result[bool]:
|
|
1096
1114
|
"""Reload the routing information.
|
|
1097
1115
|
|
|
1116
|
+
.. warning:: Route reloading is no longer available in ArangoDB 4.0.
|
|
1117
|
+
|
|
1098
1118
|
:return: True if routing was reloaded successfully.
|
|
1099
1119
|
:rtype: bool
|
|
1100
1120
|
:raise arango.exceptions.ServerReloadRoutingError: If reload fails.
|
|
@@ -1108,6 +1128,20 @@ class Database(ApiGroup):
|
|
|
1108
1128
|
|
|
1109
1129
|
return self._execute(request, response_handler)
|
|
1110
1130
|
|
|
1131
|
+
def request(self, request: Request) -> Result[Response]:
|
|
1132
|
+
"""Execute a custom request.
|
|
1133
|
+
|
|
1134
|
+
:param request: Request object to be executed.
|
|
1135
|
+
:type request: Request
|
|
1136
|
+
:return: Response object containing the result of the request.
|
|
1137
|
+
:rtype: Response
|
|
1138
|
+
"""
|
|
1139
|
+
|
|
1140
|
+
def response_handler(resp: Response) -> Response:
|
|
1141
|
+
return resp
|
|
1142
|
+
|
|
1143
|
+
return self._executor.execute(request, response_handler)
|
|
1144
|
+
|
|
1111
1145
|
def metrics(self) -> Result[str]:
|
|
1112
1146
|
"""Return server metrics in Prometheus format.
|
|
1113
1147
|
|
|
@@ -1115,7 +1149,7 @@ class Database(ApiGroup):
|
|
|
1115
1149
|
:rtype: str
|
|
1116
1150
|
:raise arango.exceptions.ServerMetricsError: If operation fails.
|
|
1117
1151
|
"""
|
|
1118
|
-
request = Request(method="get", endpoint="/_admin/metrics
|
|
1152
|
+
request = Request(method="get", endpoint="/_admin/metrics")
|
|
1119
1153
|
|
|
1120
1154
|
def response_handler(resp: Response) -> str:
|
|
1121
1155
|
if resp.is_success:
|
|
@@ -1554,7 +1588,6 @@ class Database(ApiGroup):
|
|
|
1554
1588
|
"name": col["name"],
|
|
1555
1589
|
"system": col["isSystem"],
|
|
1556
1590
|
"type": StandardCollection.types[col["type"]],
|
|
1557
|
-
"status": StandardCollection.statuses[col["status"]],
|
|
1558
1591
|
}
|
|
1559
1592
|
for col in resp.body["result"]
|
|
1560
1593
|
]
|
|
@@ -2269,6 +2302,8 @@ class Database(ApiGroup):
|
|
|
2269
2302
|
def tasks(self) -> Result[Jsons]:
|
|
2270
2303
|
"""Return all currently active server tasks.
|
|
2271
2304
|
|
|
2305
|
+
.. warning:: Tasks are no longer available in ArangoDB 4.0.
|
|
2306
|
+
|
|
2272
2307
|
:return: Currently active server tasks.
|
|
2273
2308
|
:rtype: [dict]
|
|
2274
2309
|
:raise arango.exceptions.TaskListError: If retrieval fails.
|
|
@@ -2286,6 +2321,8 @@ class Database(ApiGroup):
|
|
|
2286
2321
|
def task(self, task_id: str) -> Result[Json]:
|
|
2287
2322
|
"""Return the details of an active server task.
|
|
2288
2323
|
|
|
2324
|
+
.. warning:: Tasks are no longer available in ArangoDB 4.0.
|
|
2325
|
+
|
|
2289
2326
|
:param task_id: Server task ID.
|
|
2290
2327
|
:type task_id: str
|
|
2291
2328
|
:return: Server task details.
|
|
@@ -2312,6 +2349,8 @@ class Database(ApiGroup):
|
|
|
2312
2349
|
) -> Result[Json]:
|
|
2313
2350
|
"""Create a new server task.
|
|
2314
2351
|
|
|
2352
|
+
.. warning:: Tasks are no longer available in ArangoDB 4.0.
|
|
2353
|
+
|
|
2315
2354
|
:param name: Name of the server task.
|
|
2316
2355
|
:type name: str
|
|
2317
2356
|
:param command: Javascript command to execute.
|
|
@@ -2355,6 +2394,8 @@ class Database(ApiGroup):
|
|
|
2355
2394
|
def delete_task(self, task_id: str, ignore_missing: bool = False) -> Result[bool]:
|
|
2356
2395
|
"""Delete a server task.
|
|
2357
2396
|
|
|
2397
|
+
.. warning:: Tasks are no longer available in ArangoDB 4.0.
|
|
2398
|
+
|
|
2358
2399
|
:param task_id: Server task ID.
|
|
2359
2400
|
:type task_id: str
|
|
2360
2401
|
:param ignore_missing: Do not raise an exception on missing task.
|
arango/foxx.py
CHANGED
|
@@ -37,7 +37,10 @@ from arango.typings import Json, Jsons, Params
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
class Foxx(ApiGroup):
|
|
40
|
-
"""Foxx API wrapper.
|
|
40
|
+
"""Foxx API wrapper.
|
|
41
|
+
|
|
42
|
+
.. warning:: Foxx microservice features are no longer available in ArangoDB 4.0.
|
|
43
|
+
"""
|
|
41
44
|
|
|
42
45
|
def __repr__(self) -> str:
|
|
43
46
|
return f"<Foxx in {self._conn.db_name}>"
|
arango/replication.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
__all__ = ["Replication"]
|
|
2
2
|
|
|
3
3
|
from typing import Optional, Sequence
|
|
4
|
+
from warnings import warn
|
|
4
5
|
|
|
5
6
|
from arango.api import ApiGroup
|
|
6
7
|
from arango.exceptions import (
|
|
@@ -17,7 +18,6 @@ from arango.exceptions import (
|
|
|
17
18
|
ReplicationInventoryError,
|
|
18
19
|
ReplicationLoggerFirstTickError,
|
|
19
20
|
ReplicationLoggerStateError,
|
|
20
|
-
ReplicationMakeSlaveError,
|
|
21
21
|
ReplicationServerIDError,
|
|
22
22
|
ReplicationSyncError,
|
|
23
23
|
)
|
|
@@ -208,7 +208,9 @@ class Replication(ApiGroup):
|
|
|
208
208
|
restrict_collections: Optional[Sequence[str]] = None,
|
|
209
209
|
initial_sync_wait_time: Optional[int] = None,
|
|
210
210
|
) -> Result[Json]: # pragma: no cover
|
|
211
|
-
"""
|
|
211
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
212
|
+
|
|
213
|
+
Synchronize data from a remote endpoint.
|
|
212
214
|
|
|
213
215
|
:param endpoint: Master endpoint (e.g. "tcp://192.168.173.13:8529").
|
|
214
216
|
:type endpoint: str
|
|
@@ -246,6 +248,9 @@ class Replication(ApiGroup):
|
|
|
246
248
|
:rtype: dict
|
|
247
249
|
:raise arango.exceptions.ReplicationSyncError: If sync fails.
|
|
248
250
|
"""
|
|
251
|
+
m = "/_api/replication/sync was removed in ArangoDB v3.12.10."
|
|
252
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
253
|
+
|
|
249
254
|
data: Json = {"endpoint": endpoint}
|
|
250
255
|
|
|
251
256
|
if database is not None:
|
|
@@ -319,12 +324,20 @@ class Replication(ApiGroup):
|
|
|
319
324
|
return self._execute(request, response_handler)
|
|
320
325
|
|
|
321
326
|
def logger_first_tick(self) -> Result[str]:
|
|
322
|
-
"""
|
|
327
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
328
|
+
|
|
329
|
+
Return the first available tick value from the server.
|
|
323
330
|
|
|
324
331
|
:return: First tick value.
|
|
325
332
|
:rtype: str
|
|
326
333
|
:raise arango.exceptions.ReplicationLoggerFirstTickError: If retrieval fails.
|
|
327
334
|
"""
|
|
335
|
+
m = (
|
|
336
|
+
"/_api/replication/logger-first-tick endpoint is removed in "
|
|
337
|
+
"ArangoDB v3.12.10."
|
|
338
|
+
)
|
|
339
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
340
|
+
|
|
328
341
|
request = Request(
|
|
329
342
|
method="get",
|
|
330
343
|
endpoint="/_api/replication/logger-first-tick",
|
|
@@ -338,12 +351,17 @@ class Replication(ApiGroup):
|
|
|
338
351
|
return self._execute(request, response_handler)
|
|
339
352
|
|
|
340
353
|
def applier_config(self) -> Result[Json]:
|
|
341
|
-
"""
|
|
354
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
355
|
+
|
|
356
|
+
Return the configuration of the replication applier.
|
|
342
357
|
|
|
343
358
|
:return: Configuration of the replication applier.
|
|
344
359
|
:rtype: dict
|
|
345
360
|
:raise arango.exceptions.ReplicationApplierConfigError: If retrieval fails.
|
|
346
361
|
"""
|
|
362
|
+
m = "/_api/replication/applier-config was removed in ArangoDB v3.12.10."
|
|
363
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
364
|
+
|
|
347
365
|
request = Request(
|
|
348
366
|
method="get",
|
|
349
367
|
endpoint="/_api/replication/applier-config",
|
|
@@ -380,7 +398,9 @@ class Replication(ApiGroup):
|
|
|
380
398
|
restrict_type: Optional[str] = None,
|
|
381
399
|
restrict_collections: Optional[Sequence[str]] = None,
|
|
382
400
|
) -> Result[Json]:
|
|
383
|
-
"""
|
|
401
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
402
|
+
|
|
403
|
+
Set configuration values of the replication applier.
|
|
384
404
|
|
|
385
405
|
:param endpoint: Server endpoint (e.g. "tcp://192.168.173.13:8529").
|
|
386
406
|
:type endpoint: str
|
|
@@ -473,6 +493,9 @@ class Replication(ApiGroup):
|
|
|
473
493
|
:rtype: dict
|
|
474
494
|
:raise arango.exceptions.ReplicationApplierConfigSetError: If update fails.
|
|
475
495
|
"""
|
|
496
|
+
m = "/_api/replication/applier-config was removed in ArangoDB v3.12.10."
|
|
497
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
498
|
+
|
|
476
499
|
data: Json = {"endpoint": endpoint}
|
|
477
500
|
|
|
478
501
|
if database is not None:
|
|
@@ -528,12 +551,17 @@ class Replication(ApiGroup):
|
|
|
528
551
|
return self._execute(request, response_handler)
|
|
529
552
|
|
|
530
553
|
def applier_state(self) -> Result[Json]:
|
|
531
|
-
"""
|
|
554
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
555
|
+
|
|
556
|
+
Return the state of the replication applier
|
|
532
557
|
|
|
533
558
|
:return: Applier state and details.
|
|
534
559
|
:rtype: dict
|
|
535
560
|
:raise arango.exceptions.ReplicationApplierStateError: If retrieval fails.
|
|
536
561
|
"""
|
|
562
|
+
m = "/_api/replication/applier-state was removed in ArangoDB v3.12.10."
|
|
563
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
564
|
+
|
|
537
565
|
request = Request(
|
|
538
566
|
method="get",
|
|
539
567
|
endpoint="/_api/replication/applier-state",
|
|
@@ -547,7 +575,9 @@ class Replication(ApiGroup):
|
|
|
547
575
|
return self._execute(request, response_handler)
|
|
548
576
|
|
|
549
577
|
def start_applier(self, last_tick: Optional[str] = None) -> Result[Json]:
|
|
550
|
-
"""
|
|
578
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
579
|
+
|
|
580
|
+
Start the replication applier.
|
|
551
581
|
|
|
552
582
|
:param last_tick: The remote last log tick value from which to start
|
|
553
583
|
applying replication. If not specified, the last saved tick from
|
|
@@ -559,6 +589,9 @@ class Replication(ApiGroup):
|
|
|
559
589
|
:rtype: dict
|
|
560
590
|
:raise arango.exceptions.ReplicationApplierStartError: If operation fails.
|
|
561
591
|
"""
|
|
592
|
+
m = "/_api/replication/applier-start was removed in ArangoDB v3.12.10."
|
|
593
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
594
|
+
|
|
562
595
|
request = Request(
|
|
563
596
|
method="put",
|
|
564
597
|
endpoint="/_api/replication/applier-start",
|
|
@@ -573,12 +606,15 @@ class Replication(ApiGroup):
|
|
|
573
606
|
return self._execute(request, response_handler)
|
|
574
607
|
|
|
575
608
|
def stop_applier(self) -> Result[Json]:
|
|
576
|
-
"""
|
|
609
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
577
610
|
|
|
578
611
|
:return: Applier state and details.
|
|
579
612
|
:rtype: dict
|
|
580
613
|
:raise arango.exceptions.ReplicationApplierStopError: If operation fails.
|
|
581
614
|
"""
|
|
615
|
+
m = "/_api/replication/applier-stop was removed in ArangoDB v3.12.10."
|
|
616
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
617
|
+
|
|
582
618
|
request = Request(
|
|
583
619
|
method="put",
|
|
584
620
|
endpoint="/_api/replication/applier-stop",
|
|
@@ -591,178 +627,18 @@ class Replication(ApiGroup):
|
|
|
591
627
|
|
|
592
628
|
return self._execute(request, response_handler)
|
|
593
629
|
|
|
594
|
-
def make_slave(
|
|
595
|
-
self,
|
|
596
|
-
endpoint: str,
|
|
597
|
-
database: Optional[str] = None,
|
|
598
|
-
username: Optional[str] = None,
|
|
599
|
-
password: Optional[str] = None,
|
|
600
|
-
restrict_type: Optional[str] = None,
|
|
601
|
-
restrict_collections: Optional[Sequence[str]] = None,
|
|
602
|
-
include_system: Optional[bool] = None,
|
|
603
|
-
max_connect_retries: Optional[int] = None,
|
|
604
|
-
connect_timeout: Optional[int] = None,
|
|
605
|
-
request_timeout: Optional[int] = None,
|
|
606
|
-
chunk_size: Optional[int] = None,
|
|
607
|
-
adaptive_polling: Optional[bool] = None,
|
|
608
|
-
auto_resync: Optional[bool] = None,
|
|
609
|
-
auto_resync_retries: Optional[int] = None,
|
|
610
|
-
initial_sync_max_wait_time: Optional[int] = None,
|
|
611
|
-
connection_retry_wait_time: Optional[int] = None,
|
|
612
|
-
idle_min_wait_time: Optional[int] = None,
|
|
613
|
-
idle_max_wait_time: Optional[int] = None,
|
|
614
|
-
require_from_present: Optional[bool] = None,
|
|
615
|
-
verbose: Optional[bool] = None,
|
|
616
|
-
) -> Result[Json]: # pragma: no cover
|
|
617
|
-
"""Change the server role to slave.
|
|
618
|
-
|
|
619
|
-
:param endpoint: Master endpoint (e.g. "tcp://192.168.173.13:8529").
|
|
620
|
-
:type endpoint: str
|
|
621
|
-
:param database: Database name.
|
|
622
|
-
:type database: str | None
|
|
623
|
-
:param username: Username.
|
|
624
|
-
:type username: str | None
|
|
625
|
-
:param password: Password.
|
|
626
|
-
:type password: str | None
|
|
627
|
-
:param restrict_type: Optional string value for collection filtering.
|
|
628
|
-
Allowed values are "include" or "exclude".
|
|
629
|
-
:type restrict_type: str | None
|
|
630
|
-
:param restrict_collections: Optional list of collections for use with
|
|
631
|
-
argument **restrict_type**. If **restrict_type** set to "include",
|
|
632
|
-
only the specified collections are included. Otherwise, only the
|
|
633
|
-
specified collections are excluded.
|
|
634
|
-
:type restrict_collections: [str] | None
|
|
635
|
-
:param include_system: Whether system collection operations are
|
|
636
|
-
applied.
|
|
637
|
-
:type include_system: bool | None
|
|
638
|
-
:param max_connect_retries: Maximum number of connection attempts the
|
|
639
|
-
applier makes in a row before stopping itself.
|
|
640
|
-
:type max_connect_retries: int | None
|
|
641
|
-
:param connect_timeout: Timeout in seconds when attempting to connect
|
|
642
|
-
to the endpoint. This value is used for each connection attempt.
|
|
643
|
-
:type connect_timeout: int | None
|
|
644
|
-
:param request_timeout: Timeout in seconds for individual requests to
|
|
645
|
-
the endpoint.
|
|
646
|
-
:type request_timeout: int | None
|
|
647
|
-
:param chunk_size: Requested maximum size in bytes for log transfer
|
|
648
|
-
packets when the endpoint is contacted.
|
|
649
|
-
:type chunk_size: int | None
|
|
650
|
-
:param adaptive_polling: If set to True, replication applier sleeps
|
|
651
|
-
for an increasingly long period in case the logger server at the
|
|
652
|
-
endpoint has no replication events to apply. Using adaptive polling
|
|
653
|
-
reduces the amount of work done by both the applier and the logger
|
|
654
|
-
server when there are infrequent changes. The downside is that it
|
|
655
|
-
might take longer for the replication applier to detect new events.
|
|
656
|
-
:type adaptive_polling: bool | None
|
|
657
|
-
:param auto_resync: Whether the slave should perform a full automatic
|
|
658
|
-
resynchronization with the master in case the master cannot serve
|
|
659
|
-
log data requested by the slave, or when the replication is started
|
|
660
|
-
and no tick value can be found.
|
|
661
|
-
:type auto_resync: bool | None
|
|
662
|
-
:param auto_resync_retries: Max number of resynchronization retries.
|
|
663
|
-
Setting this to 0 disables it.
|
|
664
|
-
:type auto_resync_retries: int | None
|
|
665
|
-
:param initial_sync_max_wait_time: Max wait time in seconds the initial
|
|
666
|
-
synchronization waits for master on collection data. This value
|
|
667
|
-
is relevant even for continuous replication when **auto_resync** is
|
|
668
|
-
set to True because this may restart the initial synchronization
|
|
669
|
-
when master cannot provide log data slave requires. This value is
|
|
670
|
-
ignored if set to 0.
|
|
671
|
-
:type initial_sync_max_wait_time: int | None
|
|
672
|
-
:param connection_retry_wait_time: Time in seconds the applier idles
|
|
673
|
-
before trying to connect to master in case of connection problems.
|
|
674
|
-
This value is ignored if set to 0.
|
|
675
|
-
:type connection_retry_wait_time: int | None
|
|
676
|
-
:param idle_min_wait_time: Minimum wait time in seconds the applier
|
|
677
|
-
idles before fetching more log data from the master in case the
|
|
678
|
-
master has already sent all its log data. This wait time can be
|
|
679
|
-
used to control the frequency with which the replication applier
|
|
680
|
-
sends HTTP log fetch requests to the master in case there is no
|
|
681
|
-
write activity on the master. This value is ignored if set to 0.
|
|
682
|
-
:type idle_min_wait_time: int | None
|
|
683
|
-
:param idle_max_wait_time: Maximum wait time in seconds the applier
|
|
684
|
-
idles before fetching more log data from the master in case the
|
|
685
|
-
master has already sent all its log data. This wait time can be
|
|
686
|
-
used to control the maximum frequency with which the replication
|
|
687
|
-
applier sends HTTP log fetch requests to the master in case there
|
|
688
|
-
is no write activity on the master. Applies only when argument
|
|
689
|
-
**adaptive_polling** is set to True. This value is ignored if set
|
|
690
|
-
to 0.
|
|
691
|
-
:type idle_max_wait_time: int | None
|
|
692
|
-
:param require_from_present: If set to True, replication applier checks
|
|
693
|
-
at start whether the start tick from which it starts or resumes
|
|
694
|
-
replication is still present on the master. If not, then there
|
|
695
|
-
would be data loss. If set to True, the replication applier aborts
|
|
696
|
-
with an appropriate error message. If set to False, the applier
|
|
697
|
-
still starts and ignores the data loss.
|
|
698
|
-
:type require_from_present: bool | None
|
|
699
|
-
:param verbose: If set to True, a log line is emitted for all
|
|
700
|
-
operations performed by the replication applier. This should be
|
|
701
|
-
used for debugging replication problems only.
|
|
702
|
-
:type verbose: bool | None
|
|
703
|
-
:return: Replication details.
|
|
704
|
-
:rtype: dict
|
|
705
|
-
:raise arango.exceptions.ReplicationApplierStopError: If operation fails.
|
|
706
|
-
"""
|
|
707
|
-
data: Json = {"endpoint": endpoint}
|
|
708
|
-
|
|
709
|
-
if database is not None:
|
|
710
|
-
data["database"] = database
|
|
711
|
-
if username is not None:
|
|
712
|
-
data["username"] = username
|
|
713
|
-
if password is not None:
|
|
714
|
-
data["password"] = password
|
|
715
|
-
if restrict_type is not None:
|
|
716
|
-
data["restrictType"] = restrict_type
|
|
717
|
-
if restrict_collections is not None:
|
|
718
|
-
data["restrictCollections"] = restrict_collections
|
|
719
|
-
if include_system is not None:
|
|
720
|
-
data["includeSystem"] = include_system
|
|
721
|
-
if max_connect_retries is not None:
|
|
722
|
-
data["maxConnectRetries"] = max_connect_retries
|
|
723
|
-
if connect_timeout is not None:
|
|
724
|
-
data["connectTimeout"] = connect_timeout
|
|
725
|
-
if request_timeout is not None:
|
|
726
|
-
data["requestTimeout"] = request_timeout
|
|
727
|
-
if chunk_size is not None:
|
|
728
|
-
data["chunkSize"] = chunk_size
|
|
729
|
-
if adaptive_polling is not None:
|
|
730
|
-
data["adaptivePolling"] = adaptive_polling
|
|
731
|
-
if auto_resync is not None:
|
|
732
|
-
data["autoResync"] = auto_resync
|
|
733
|
-
if auto_resync_retries is not None:
|
|
734
|
-
data["autoResyncRetries"] = auto_resync_retries
|
|
735
|
-
if initial_sync_max_wait_time is not None:
|
|
736
|
-
data["initialSyncMaxWaitTime"] = initial_sync_max_wait_time
|
|
737
|
-
if connection_retry_wait_time is not None:
|
|
738
|
-
data["connectionRetryWaitTime"] = connection_retry_wait_time
|
|
739
|
-
if idle_min_wait_time is not None:
|
|
740
|
-
data["idleMinWaitTime"] = idle_min_wait_time
|
|
741
|
-
if idle_max_wait_time is not None:
|
|
742
|
-
data["idleMaxWaitTime"] = idle_max_wait_time
|
|
743
|
-
if require_from_present is not None:
|
|
744
|
-
data["requireFromPresent"] = require_from_present
|
|
745
|
-
if verbose is not None:
|
|
746
|
-
data["verbose"] = verbose
|
|
747
|
-
|
|
748
|
-
request = Request(
|
|
749
|
-
method="put", endpoint="/_api/replication/make-slave", data=data
|
|
750
|
-
)
|
|
751
|
-
|
|
752
|
-
def response_handler(resp: Response) -> Json:
|
|
753
|
-
if resp.is_success:
|
|
754
|
-
return format_replication_applier_state(resp.body)
|
|
755
|
-
raise ReplicationMakeSlaveError(resp, request)
|
|
756
|
-
|
|
757
|
-
return self._execute(request, response_handler)
|
|
758
|
-
|
|
759
630
|
def server_id(self) -> Result[str]:
|
|
760
|
-
"""
|
|
631
|
+
"""**Removed** in ArangoDB v3.12.10.
|
|
632
|
+
|
|
633
|
+
Return this server's ID.
|
|
761
634
|
|
|
762
635
|
:return: Server ID.
|
|
763
636
|
:rtype: str
|
|
764
637
|
:raise arango.exceptions.ReplicationServerIDError: If retrieval fails.
|
|
765
638
|
"""
|
|
639
|
+
m = "/_api/replication/server-id was removed in ArangoDB v3.12.10."
|
|
640
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
641
|
+
|
|
766
642
|
request = Request(
|
|
767
643
|
method="get",
|
|
768
644
|
endpoint="/_api/replication/server-id",
|
arango/utils.py
CHANGED
|
@@ -6,10 +6,9 @@ __all__ = [
|
|
|
6
6
|
"is_none_or_str",
|
|
7
7
|
]
|
|
8
8
|
|
|
9
|
-
import json
|
|
10
9
|
import logging
|
|
11
10
|
from contextlib import contextmanager
|
|
12
|
-
from typing import Any, Iterator, Optional, Sequence, Union
|
|
11
|
+
from typing import Any, Iterator, Optional, Sequence, Tuple, Union
|
|
13
12
|
|
|
14
13
|
from arango.exceptions import DocumentParseError, SortValidationError
|
|
15
14
|
from arango.typings import Json, Jsons
|
|
@@ -109,23 +108,48 @@ def get_batches(elements: Sequence[Json], batch_size: int) -> Iterator[Sequence[
|
|
|
109
108
|
yield elements[index : index + batch_size]
|
|
110
109
|
|
|
111
110
|
|
|
112
|
-
def
|
|
111
|
+
def _build_attribute_expression(field: str, prefix: str, bind_vars: Json) -> str:
|
|
112
|
+
"""Build a bind-safe AQL document attribute expression."""
|
|
113
|
+
bind_vars[prefix] = field
|
|
114
|
+
field_access = f"doc[@{prefix}]"
|
|
115
|
+
|
|
116
|
+
if "." not in field:
|
|
117
|
+
return field_access
|
|
118
|
+
|
|
119
|
+
nested_access = "doc"
|
|
120
|
+
for field_index, field_part in enumerate(field.split(".")):
|
|
121
|
+
field_var = f"{prefix}_{field_index}"
|
|
122
|
+
bind_vars[field_var] = field_part
|
|
123
|
+
nested_access += f"[@{field_var}]"
|
|
124
|
+
|
|
125
|
+
return f"(HAS(doc, @{prefix}) ? {field_access} : {nested_access})"
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def build_filter_conditions(filters: Json) -> Tuple[str, Json]:
|
|
113
129
|
"""Build a filter condition for an AQL query.
|
|
114
130
|
|
|
115
131
|
:param filters: Document filters.
|
|
116
132
|
:type filters: Dict[str, Any]
|
|
117
|
-
:return: The complete AQL filter condition.
|
|
118
|
-
:rtype: str
|
|
133
|
+
:return: The complete AQL filter condition and its bind variables.
|
|
134
|
+
:rtype: tuple[str, dict]
|
|
119
135
|
"""
|
|
120
136
|
if not filters:
|
|
121
|
-
return ""
|
|
137
|
+
return "", {}
|
|
122
138
|
|
|
123
139
|
conditions = []
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
140
|
+
bind_vars: Json = {}
|
|
141
|
+
for filter_index, (field, value) in enumerate(filters.items()):
|
|
142
|
+
field_access = _build_attribute_expression(
|
|
143
|
+
field,
|
|
144
|
+
f"filter_field_{filter_index}",
|
|
145
|
+
bind_vars,
|
|
146
|
+
)
|
|
127
147
|
|
|
128
|
-
|
|
148
|
+
value_var = f"filter_value_{filter_index}"
|
|
149
|
+
bind_vars[value_var] = value
|
|
150
|
+
conditions.append(f"{field_access} == @{value_var}")
|
|
151
|
+
|
|
152
|
+
return "FILTER " + " AND ".join(conditions), bind_vars
|
|
129
153
|
|
|
130
154
|
|
|
131
155
|
def validate_sort_parameters(sort: Jsons) -> bool:
|
|
@@ -148,20 +172,26 @@ def validate_sort_parameters(sort: Jsons) -> bool:
|
|
|
148
172
|
return True
|
|
149
173
|
|
|
150
174
|
|
|
151
|
-
def build_sort_expression(sort: Optional[Jsons]) -> str:
|
|
175
|
+
def build_sort_expression(sort: Optional[Jsons]) -> Tuple[str, Json]:
|
|
152
176
|
"""Build a sort condition for an AQL query.
|
|
153
177
|
|
|
154
178
|
:param sort: Document sort parameters.
|
|
155
179
|
:type sort: Jsons | None
|
|
156
|
-
:return: The complete AQL sort condition.
|
|
157
|
-
:rtype: str
|
|
180
|
+
:return: The complete AQL sort condition and its bind variables.
|
|
181
|
+
:rtype: tuple[str, dict]
|
|
158
182
|
"""
|
|
159
183
|
if not sort:
|
|
160
|
-
return ""
|
|
184
|
+
return "", {}
|
|
161
185
|
|
|
162
186
|
sort_chunks = []
|
|
163
|
-
|
|
164
|
-
|
|
187
|
+
bind_vars: Json = {}
|
|
188
|
+
for sort_index, sort_param in enumerate(sort):
|
|
189
|
+
field_access = _build_attribute_expression(
|
|
190
|
+
sort_param["sort_by"],
|
|
191
|
+
f"sort_field_{sort_index}",
|
|
192
|
+
bind_vars,
|
|
193
|
+
)
|
|
194
|
+
chunk = f"{field_access} {sort_param['sort_order'].upper()}"
|
|
165
195
|
sort_chunks.append(chunk)
|
|
166
196
|
|
|
167
|
-
return "SORT " + ", ".join(sort_chunks)
|
|
197
|
+
return "SORT " + ", ".join(sort_chunks), bind_vars
|
arango/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "8.3.
|
|
1
|
+
__version__ = "8.3.4"
|
arango/wal.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
__all__ = ["WAL"]
|
|
2
2
|
|
|
3
3
|
from typing import Optional
|
|
4
|
+
from warnings import warn
|
|
4
5
|
|
|
5
6
|
from arango.api import ApiGroup
|
|
6
7
|
from arango.exceptions import (
|
|
@@ -28,12 +29,15 @@ class WAL(ApiGroup): # pragma: no cover
|
|
|
28
29
|
"""WAL (Write-Ahead Log) API wrapper."""
|
|
29
30
|
|
|
30
31
|
def properties(self) -> Result[Json]:
|
|
31
|
-
"""Return WAL properties.
|
|
32
|
+
"""Return WAL properties. **Removed** in ArangoDB v4.0.0.
|
|
32
33
|
|
|
33
34
|
:return: WAL properties.
|
|
34
35
|
:rtype: dict
|
|
35
36
|
:raise arango.exceptions.WALPropertiesError: If retrieval fails.
|
|
36
37
|
"""
|
|
38
|
+
m = "/_admin/wal/properties was removed in ArangoDB v4.0.0."
|
|
39
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
40
|
+
|
|
37
41
|
request = Request(method="get", endpoint="/_admin/wal/properties")
|
|
38
42
|
|
|
39
43
|
def response_handler(resp: Response) -> Json:
|
|
@@ -52,7 +56,7 @@ class WAL(ApiGroup): # pragma: no cover
|
|
|
52
56
|
throttle_wait: Optional[int] = None,
|
|
53
57
|
throttle_limit: Optional[int] = None,
|
|
54
58
|
) -> Result[Json]:
|
|
55
|
-
"""Configure WAL properties.
|
|
59
|
+
"""Configure WAL properties. **Removed in ArangoDB v4.0.0.**
|
|
56
60
|
|
|
57
61
|
:param oversized_ops: If set to True, operations bigger than a single
|
|
58
62
|
log file are allowed to be executed and stored.
|
|
@@ -74,6 +78,9 @@ class WAL(ApiGroup): # pragma: no cover
|
|
|
74
78
|
:rtype: dict
|
|
75
79
|
:raise arango.exceptions.WALConfigureError: If operation fails.
|
|
76
80
|
"""
|
|
81
|
+
m = "/_admin/wal/properties was removed in ArangoDB v4.0.0."
|
|
82
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
83
|
+
|
|
77
84
|
data: Json = {}
|
|
78
85
|
if oversized_ops is not None:
|
|
79
86
|
data["allowOversizeEntries"] = oversized_ops
|
|
@@ -98,7 +105,9 @@ class WAL(ApiGroup): # pragma: no cover
|
|
|
98
105
|
return self._execute(request, response_handler)
|
|
99
106
|
|
|
100
107
|
def transactions(self) -> Result[Json]:
|
|
101
|
-
"""
|
|
108
|
+
"""**Removed** in ArangoDB v4.0.0.
|
|
109
|
+
|
|
110
|
+
Return details on currently running WAL transactions.
|
|
102
111
|
|
|
103
112
|
Fields in the returned details are as follows:
|
|
104
113
|
|
|
@@ -118,6 +127,9 @@ class WAL(ApiGroup): # pragma: no cover
|
|
|
118
127
|
:rtype: dict
|
|
119
128
|
:raise arango.exceptions.WALTransactionListError: If retrieval fails.
|
|
120
129
|
"""
|
|
130
|
+
m = "/_admin/wal/transactions was removed in ArangoDB v4.0.0."
|
|
131
|
+
warn(m, DeprecationWarning, stacklevel=2)
|
|
132
|
+
|
|
121
133
|
request = Request(method="get", endpoint="/_admin/wal/transactions")
|
|
122
134
|
|
|
123
135
|
def response_handler(resp: Response) -> Json:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-arango
|
|
3
|
-
Version: 8.3.
|
|
3
|
+
Version: 8.3.4
|
|
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>
|
|
@@ -183,7 +183,7 @@ edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
|
|
|
183
183
|
# Traverse the graph in outbound direction, breath-first.
|
|
184
184
|
query = """
|
|
185
185
|
FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
|
|
186
|
-
OPTIONS {
|
|
186
|
+
OPTIONS { order: 'bfs', uniqueVertices: 'global' }
|
|
187
187
|
RETURN {vertex: v, edge: e, path: p}
|
|
188
188
|
"""
|
|
189
189
|
cursor = db.aql.execute(query)
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
arango/__init__.py,sha256=SFKHBP0iYw1c4mJbLn6pxiGIKVUpsS_nQcZ0aEptrZw,192
|
|
2
2
|
arango/api.py,sha256=OzN3d4p1fagRG_BXnjgrp0TeE__hQmm9WDEkjefa6UA,1956
|
|
3
|
-
arango/aql.py,sha256=
|
|
3
|
+
arango/aql.py,sha256=HaoEx1CWvEtKTkbocEtS-73MyAAhuTxJnenqDg41voM,31420
|
|
4
4
|
arango/backup.py,sha256=lK7ihCRPrsBlQ35KtyYplhX6Lw0GzqCbGTLPbPTBh20,8651
|
|
5
5
|
arango/client.py,sha256=t-mJZ9I7ZJebILW6zm4qAhgExEEzvwTVNdkHp7DP2iU,11787
|
|
6
|
-
arango/cluster.py,sha256=
|
|
7
|
-
arango/collection.py,sha256=
|
|
6
|
+
arango/cluster.py,sha256=4EAMftT_Zm2kBVtvWF9RSy-EYdsGgKujE6mI52HtV8Q,18655
|
|
7
|
+
arango/collection.py,sha256=FdjDzfqAY333MA6frrfMU0-ZuTmnDwEZlF1c0HEbuwA,135955
|
|
8
8
|
arango/connection.py,sha256=euqleZQOBkZ06zkY1uztGWeDeZLEYnekvHs2WK_K1Gk,18919
|
|
9
9
|
arango/cursor.py,sha256=4iIhYXWwzHnxKKk0oNk-ynNeQ1BWJDS4gy1ApzYtNl8,11156
|
|
10
|
-
arango/database.py,sha256=
|
|
10
|
+
arango/database.py,sha256=wAGxx3fhDL1vzWMQZVZQ39ID3iggJ6jxHmmL-JCZYTs,134528
|
|
11
11
|
arango/errno.py,sha256=4oKY9IyyzjOitbywhjH8S214qeNtpDlQg7JsHENJNoU,25245
|
|
12
12
|
arango/exceptions.py,sha256=N2sUD6_aJQqsrXXluDrQkXo143d8M07ziqZQK5VN_rk,26225
|
|
13
13
|
arango/executor.py,sha256=ahez3ar-FLZLWv4pu1IYhAi_EdhbwsME82N_hkB1PSw,16000
|
|
14
14
|
arango/formatter.py,sha256=v_q93uvmUsYVsvxoHb2fAskqGxi3zRT88IUQCZgc9z4,42861
|
|
15
|
-
arango/foxx.py,sha256=
|
|
15
|
+
arango/foxx.py,sha256=Ni5AnmuTq2ghD_yXHZkDkH45gj5J6lqEWYScp-9aGC0,32828
|
|
16
16
|
arango/graph.py,sha256=UPxiN0JgyzZGYc1aZZ1tiiOsz9fStInEGS6SySDaFW0,36282
|
|
17
17
|
arango/http.py,sha256=36Us7VBcOcHH2kdWg8ZpPkD-4Po8U5ScQvR1MATGVr0,10215
|
|
18
18
|
arango/job.py,sha256=yLjlMVuSK5ibcyf3zAHozMzMXPSYk769A-VUfyNrY9c,7054
|
|
19
19
|
arango/pregel.py,sha256=AqL8o8YaPYN_LkJiGhQTfXN_AzjGGoAr4nl-e5jus4A,5749
|
|
20
20
|
arango/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
arango/replication.py,sha256=
|
|
21
|
+
arango/replication.py,sha256=atvbGMMdEfIjwBKkzWJ453YjXdQMKorNwKEeM-Og_zg,26681
|
|
22
22
|
arango/request.py,sha256=dmx_fFg5kHq82fA-dhFStJERYtipuZSTW1lwXrbQqOo,4167
|
|
23
23
|
arango/resolver.py,sha256=hhTJHzNKrg3KpzmKIa-eZSogUBwQuWAID5yfHJ9RYH8,4215
|
|
24
24
|
arango/response.py,sha256=n55yXyrsUldOQV8FYUgX9PiVvTW-R9nVOyDUTcnsN1o,2164
|
|
25
25
|
arango/result.py,sha256=nILp1HZCl06awosbDi1AL_LCDDXV0DEi1KBkywG6uoI,168
|
|
26
26
|
arango/typings.py,sha256=G8BKOORxaVKSS3kaxHjVaXD0TIJkd1Cs8j2nuKwSKlQ,779
|
|
27
|
-
arango/utils.py,sha256=
|
|
28
|
-
arango/version.py,sha256=
|
|
29
|
-
arango/wal.py,sha256=
|
|
30
|
-
python_arango-8.3.
|
|
31
|
-
python_arango-8.3.
|
|
32
|
-
python_arango-8.3.
|
|
33
|
-
python_arango-8.3.
|
|
34
|
-
python_arango-8.3.
|
|
27
|
+
arango/utils.py,sha256=E2AsqCLknKpv-5EEpoT7oGsZGNBnPG3g1uuS51wdvDU,5835
|
|
28
|
+
arango/version.py,sha256=L6FFKJ9jr3FOrnDCDKrFA8EDeYijiBWwZ9MHgZ122DM,22
|
|
29
|
+
arango/wal.py,sha256=ubZvztThBrmPDBYkpUtnz8XDLICRTfaMeXSfqQwMauw,11700
|
|
30
|
+
python_arango-8.3.4.dist-info/licenses/LICENSE,sha256=e86a4kkFfMBuoffCn4RLmQGC2LUqNs78i5npEsJ1b5I,1072
|
|
31
|
+
python_arango-8.3.4.dist-info/METADATA,sha256=WqV_akKoCfPMA7oCcrGkgomOuWRfk49giB7DwKKdy14,8356
|
|
32
|
+
python_arango-8.3.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
33
|
+
python_arango-8.3.4.dist-info/top_level.txt,sha256=F8H1mznbOGduHSsSET9uiPd72kJ1fGbejiuzYMm9XqA,7
|
|
34
|
+
python_arango-8.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|