Skip to content

Commit 8199148

Browse files
committed
Add new parameters stream and skip_inaccessible_cols to method AQL.execute
1 parent e9569ef commit 8199148

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

arango/aql.py

+31-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ def execute(self,
174174
intermediate_commit_size=None,
175175
satellite_sync_wait=None,
176176
read_collections=None,
177-
write_collections=None):
177+
write_collections=None,
178+
stream=None,
179+
skip_inaccessible_cols=None):
178180
"""Execute the query and return the result cursor.
179181
180182
:param query: Query to execute.
@@ -231,7 +233,7 @@ def execute(self,
231233
:type intermediate_commit_size: int
232234
:param satellite_sync_wait: Number of seconds in which the server must
233235
synchronize the satellite collections involved in the query. When
234-
the threshold is reached, the query is stopped. Applies only to
236+
the threshold is reached, the query is stopped. Available only for
235237
enterprise version of ArangoDB.
236238
:type satellite_sync_wait: int | float
237239
:param read_collections: Names of collections read during query
@@ -240,6 +242,28 @@ def execute(self,
240242
:param write_collections: Names of collections written to during query
241243
execution. Required for :doc:`transactions <transaction>`.
242244
:type write_collections: [str | unicode]
245+
:param stream: If set to True, query is executed in streaming fashion:
246+
query result is not stored server-side but calculated on the fly.
247+
Note: long-running queries hold collection locks for as long as the
248+
cursor exists. If set to False, query is executed right away in its
249+
entirety. Results are either returned right away (if the result set
250+
is small enough), or stored server-side and accessible via cursors
251+
(while respecting the ttl). You should use this parameter only for
252+
short-running queries or without exclusive locks (write-locks on
253+
MMFiles). Note: parameters **cache**, **count** and **full_count**
254+
do not work for streaming queries. Query statistics, warnings and
255+
profiling data are made available only after the query is finished.
256+
Default value is False.
257+
:type stream: bool
258+
:param skip_inaccessible_cols: If set to True, collections without user
259+
access are skipped, and query executes normally instead of raising
260+
an error. This helps certain use cases: a graph may contain several
261+
collections, and users with different access levels may execute the
262+
same query. This parameter lets you limit the result set by user
263+
access. Cannot be used in :doc:`transactions <transaction>` and is
264+
available only for enterprise version of ArangoDB. Default value is
265+
False.
266+
:type skip_inaccessible_cols: bool
243267
:return: Result cursor.
244268
:rtype: arango.cursor.Cursor
245269
:raise arango.exceptions.AQLQueryExecuteError: If execute fails.
@@ -277,6 +301,11 @@ def execute(self,
277301
options['intermediateCommitSize'] = intermediate_commit_size
278302
if satellite_sync_wait is not None:
279303
options['satelliteSyncWait'] = satellite_sync_wait
304+
if stream is not None:
305+
options['stream'] = stream
306+
if skip_inaccessible_cols is not None:
307+
options['skipInaccessibleCollections'] = skip_inaccessible_cols
308+
280309
if options:
281310
data['options'] = options
282311
data.update(options)

arango/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.3.0'
1+
__version__ = '4.4.0'

tests/test_aql.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ def test_aql_query_management(db, bad_db, col, docs):
102102
intermediate_commit_size=1000,
103103
satellite_sync_wait=False,
104104
write_collections=[col.name],
105-
read_collections=[col.name]
105+
read_collections=[col.name],
106+
stream=False,
107+
skip_inaccessible_cols=True
106108
)
107109
if db.context == 'transaction':
108110
assert cursor.id is None

0 commit comments

Comments
 (0)