python-arango 8.3.2__tar.gz → 8.3.4__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.3.4/.circleci/config.yml +200 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/.github/workflows/pypi.yaml +2 -2
- {python_arango-8.3.2 → python_arango-8.3.4}/PKG-INFO +2 -2
- {python_arango-8.3.2 → python_arango-8.3.4}/README.md +1 -1
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/aql.py +6 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/cluster.py +5 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/collection.py +43 -157
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/database.py +43 -2
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/foxx.py +4 -1
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/replication.py +50 -174
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/utils.py +47 -17
- python_arango-8.3.4/arango/version.py +1 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/wal.py +15 -3
- python_arango-8.3.4/ci/conftest.py +1 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/aql.rst +4 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/cluster.rst +0 -1
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/collection.rst +0 -2
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/database.rst +8 -1
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/foxx.rst +4 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/graph.rst +1 -1
- python_arango-8.3.4/docs/replication.rst +61 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/simple.rst +0 -3
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/task.rst +4 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/python_arango.egg-info/PKG-INFO +2 -2
- {python_arango-8.3.2 → python_arango-8.3.4}/python_arango.egg-info/SOURCES.txt +3 -0
- python_arango-8.3.4/python_arango.egg-info/scm_file_list.json +130 -0
- python_arango-8.3.4/python_arango.egg-info/scm_version.json +8 -0
- python_arango-8.3.4/starter.sh +84 -0
- python_arango-8.3.2/.circleci/config.yml +0 -101
- python_arango-8.3.2/arango/version.py +0 -1
- python_arango-8.3.2/docs/replication.rst +0 -115
- python_arango-8.3.2/starter.sh +0 -60
- {python_arango-8.3.2 → python_arango-8.3.4}/.github/workflows/codeql.yaml +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/.github/workflows/docs.yaml +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/.gitignore +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/.pre-commit-config.yaml +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/.readthedocs.yaml +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/CONTRIBUTING.md +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/LICENSE +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/MANIFEST.in +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/__init__.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/api.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/backup.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/client.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/connection.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/cursor.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/errno.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/exceptions.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/executor.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/formatter.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/graph.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/http.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/job.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/pregel.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/py.typed +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/request.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/resolver.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/response.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/result.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/arango/typings.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/Makefile +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/admin.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/analyzer.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/async.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/auth.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/backup.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/batch.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/certificates.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/compression.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/conf.py +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/contributing.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/cursor.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/document.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/errno.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/errors.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/http.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/index.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/indexes.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/logging.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/make.bat +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/overload.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/overview.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/pregel.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/requirements.txt +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/schema.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/serializer.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/specs.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/static/logo.png +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/threading.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/transaction.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/user.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/view.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/docs/wal.rst +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/pyproject.toml +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/python_arango.egg-info/dependency_links.txt +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/python_arango.egg-info/requires.txt +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/python_arango.egg-info/top_level.txt +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/setup.cfg +0 -0
- {python_arango-8.3.2 → python_arango-8.3.4}/setup.py +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
executors:
|
|
4
|
+
python-container:
|
|
5
|
+
parameters:
|
|
6
|
+
python_version:
|
|
7
|
+
type: string
|
|
8
|
+
default: "3.14"
|
|
9
|
+
docker:
|
|
10
|
+
- image: cimg/python:<< parameters.python_version >>
|
|
11
|
+
resource_class: arangodb/small-amd64
|
|
12
|
+
arangodb-container:
|
|
13
|
+
parameters:
|
|
14
|
+
arangodb_image:
|
|
15
|
+
type: string
|
|
16
|
+
docker:
|
|
17
|
+
- image: << parameters.arangodb_image >>
|
|
18
|
+
entrypoint: /bin/sh
|
|
19
|
+
command: -c "while true; do sleep 10; done"
|
|
20
|
+
user: root
|
|
21
|
+
resource_class: arangodb/medium-amd64
|
|
22
|
+
|
|
23
|
+
workflows:
|
|
24
|
+
ci:
|
|
25
|
+
jobs:
|
|
26
|
+
- lint
|
|
27
|
+
- import-test:
|
|
28
|
+
name: Imports (Python << matrix.python_version >>)
|
|
29
|
+
matrix:
|
|
30
|
+
parameters:
|
|
31
|
+
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
32
|
+
- integration-test:
|
|
33
|
+
name: ArangoDB (enterprise, 3.12 << matrix.arangodb_config >>)
|
|
34
|
+
matrix:
|
|
35
|
+
parameters:
|
|
36
|
+
arangodb_config: ["single", "cluster"]
|
|
37
|
+
arangodb_image: ["arangodb/enterprise:3.12"]
|
|
38
|
+
arangodb_conf_version: ["3.12"]
|
|
39
|
+
- integration-test:
|
|
40
|
+
name: ArangoDB (enterprise-preview, 4.0-nightly << matrix.arangodb_config >>)
|
|
41
|
+
matrix:
|
|
42
|
+
parameters:
|
|
43
|
+
arangodb_config: ["single", "cluster"]
|
|
44
|
+
arangodb_image: ["arangodb/enterprise-preview:4.0-nightly"]
|
|
45
|
+
arangodb_conf_version: ["4.0"]
|
|
46
|
+
|
|
47
|
+
jobs:
|
|
48
|
+
lint:
|
|
49
|
+
executor: python-container
|
|
50
|
+
steps:
|
|
51
|
+
- checkout
|
|
52
|
+
- run:
|
|
53
|
+
name: Install Dependencies
|
|
54
|
+
command: python -m pip install .[dev]
|
|
55
|
+
- run:
|
|
56
|
+
name: Run black
|
|
57
|
+
command: black --check --verbose --diff --color --config=pyproject.toml ./arango ./tests/
|
|
58
|
+
- run:
|
|
59
|
+
name: Run flake8
|
|
60
|
+
command: flake8 ./arango ./tests
|
|
61
|
+
- run:
|
|
62
|
+
name: Run isort
|
|
63
|
+
command: isort --check ./arango ./tests
|
|
64
|
+
- run:
|
|
65
|
+
name: Run mypy
|
|
66
|
+
command: mypy ./arango
|
|
67
|
+
import-test:
|
|
68
|
+
parameters:
|
|
69
|
+
python_version:
|
|
70
|
+
type: string
|
|
71
|
+
executor:
|
|
72
|
+
name: python-container
|
|
73
|
+
python_version: << parameters.python_version >>
|
|
74
|
+
steps:
|
|
75
|
+
- checkout
|
|
76
|
+
- run:
|
|
77
|
+
name: Install Dependencies
|
|
78
|
+
command: |
|
|
79
|
+
python --version
|
|
80
|
+
python -m pip install .[dev]
|
|
81
|
+
- run:
|
|
82
|
+
name: Run Import Tests
|
|
83
|
+
command: python -m pytest tests/test_imports.py --skip-arango-setup --color=yes --code-highlight=yes
|
|
84
|
+
integration-test:
|
|
85
|
+
parameters:
|
|
86
|
+
arangodb_config:
|
|
87
|
+
type: string
|
|
88
|
+
arangodb_image:
|
|
89
|
+
type: string
|
|
90
|
+
arangodb_conf_version:
|
|
91
|
+
type: string
|
|
92
|
+
executor:
|
|
93
|
+
name: arangodb-container
|
|
94
|
+
arangodb_image: << parameters.arangodb_image >>
|
|
95
|
+
steps:
|
|
96
|
+
- run:
|
|
97
|
+
name: Bootstrap CI Tools
|
|
98
|
+
command: |
|
|
99
|
+
apk add --no-cache \
|
|
100
|
+
bash \
|
|
101
|
+
build-base \
|
|
102
|
+
ca-certificates \
|
|
103
|
+
curl \
|
|
104
|
+
git \
|
|
105
|
+
jq \
|
|
106
|
+
openssh-client \
|
|
107
|
+
openssl-dev \
|
|
108
|
+
py3-pip \
|
|
109
|
+
py3-virtualenv \
|
|
110
|
+
python3 \
|
|
111
|
+
python3-dev
|
|
112
|
+
- checkout
|
|
113
|
+
- run:
|
|
114
|
+
name: Setup ArangoDB
|
|
115
|
+
command: |
|
|
116
|
+
mkdir -p /tests
|
|
117
|
+
if [ ! -e /tests/static ]; then
|
|
118
|
+
ln -s "$PWD/tests/static" /tests/static
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
conf_file="/tests/static/<< parameters.arangodb_config >>-<< parameters.arangodb_conf_version >>.conf"
|
|
122
|
+
if [ ! -f "$conf_file" ]; then
|
|
123
|
+
echo "Missing configuration file: $conf_file"
|
|
124
|
+
exit 1
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
arangodb --configuration="$conf_file" > arangodb.log 2>&1 &
|
|
128
|
+
echo "$!" > arangodb.pid
|
|
129
|
+
|
|
130
|
+
ports="8529"
|
|
131
|
+
if [ << parameters.arangodb_config >> = "cluster" ]; then
|
|
132
|
+
ports="$ports 8539 8549"
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
for port in $ports; do
|
|
136
|
+
echo "Waiting for ArangoDB at http://localhost:$port/_api/version"
|
|
137
|
+
for attempt in $(seq 1 120); do
|
|
138
|
+
if curl --fail --silent --show-error \
|
|
139
|
+
--user root:passwd \
|
|
140
|
+
"http://localhost:$port/_api/version" | jq; then
|
|
141
|
+
break
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
if ! kill -0 "$(cat arangodb.pid)" 2>/dev/null; then
|
|
145
|
+
echo "ArangoDB process exited before port $port became ready"
|
|
146
|
+
exit 1
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
if [ "$attempt" -eq 120 ]; then
|
|
150
|
+
echo "Timed out waiting for ArangoDB on port $port"
|
|
151
|
+
exit 1
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
sleep 1
|
|
155
|
+
done
|
|
156
|
+
done
|
|
157
|
+
- run:
|
|
158
|
+
name: Show ArangoDB Logs
|
|
159
|
+
command: tail -n 1000 arangodb.log
|
|
160
|
+
when: always
|
|
161
|
+
- run:
|
|
162
|
+
name: Setup Python
|
|
163
|
+
shell: /bin/bash -eo pipefail
|
|
164
|
+
command: |
|
|
165
|
+
python3 --version
|
|
166
|
+
python3 -m virtualenv .venv
|
|
167
|
+
source .venv/bin/activate
|
|
168
|
+
python --version
|
|
169
|
+
python -m pip --version
|
|
170
|
+
- run:
|
|
171
|
+
name: Install Dependencies
|
|
172
|
+
shell: /bin/bash -eo pipefail
|
|
173
|
+
command: |
|
|
174
|
+
source .venv/bin/activate
|
|
175
|
+
python -m pip install -e .[dev]
|
|
176
|
+
- run:
|
|
177
|
+
name: Run pytest
|
|
178
|
+
shell: /bin/bash -eo pipefail
|
|
179
|
+
command: |
|
|
180
|
+
mkdir test-results
|
|
181
|
+
mkdir htmlcov
|
|
182
|
+
|
|
183
|
+
source .venv/bin/activate
|
|
184
|
+
|
|
185
|
+
args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost" "--port=8529")
|
|
186
|
+
if [ << parameters.arangodb_config >> = "cluster" ]; then
|
|
187
|
+
args+=("--cluster" "--port=8539" "--port=8549")
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
echo "Running pytest with args: ${args[@]}"
|
|
191
|
+
pytest tests --cov=arango --cov-report=html:htmlcov --color=yes --code-highlight=yes "${args[@]}"
|
|
192
|
+
- store_artifacts:
|
|
193
|
+
path: htmlcov
|
|
194
|
+
destination: coverage-report
|
|
195
|
+
- store_artifacts:
|
|
196
|
+
path: test-results
|
|
197
|
+
- store_artifacts:
|
|
198
|
+
path: arangodb.log
|
|
199
|
+
- store_test_results:
|
|
200
|
+
path: test-results
|
|
@@ -43,10 +43,10 @@ jobs:
|
|
|
43
43
|
env:
|
|
44
44
|
TWINE_USERNAME: __token__
|
|
45
45
|
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }}
|
|
46
|
-
run: twine upload --repository testpypi dist/*
|
|
46
|
+
run: twine upload --verbose --repository testpypi dist/*
|
|
47
47
|
|
|
48
48
|
- name: Publish to PyPI
|
|
49
49
|
env:
|
|
50
50
|
TWINE_USERNAME: __token__
|
|
51
51
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
52
|
-
run: twine upload --repository pypi dist/*
|
|
52
|
+
run: twine upload --verbose --repository pypi dist/*
|
|
@@ -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)
|
|
@@ -118,7 +118,7 @@ edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
|
|
|
118
118
|
# Traverse the graph in outbound direction, breath-first.
|
|
119
119
|
query = """
|
|
120
120
|
FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
|
|
121
|
-
OPTIONS {
|
|
121
|
+
OPTIONS { order: 'bfs', uniqueVertices: 'global' }
|
|
122
122
|
RETURN {vertex: v, edge: e, path: p}
|
|
123
123
|
"""
|
|
124
124
|
cursor = db.aql.execute(query)
|
|
@@ -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
|
|
@@ -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.
|
|
@@ -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.
|