Skip to content

Commit

Permalink
Add new parameters stream and skip_inaccessible_cols to method AQL.ex…
Browse files Browse the repository at this point in the history
…ecute
  • Loading branch information
joowani committed Jan 4, 2019
1 parent e9569ef commit 8199148
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
33 changes: 31 additions & 2 deletions arango/aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def execute(self,
intermediate_commit_size=None,
satellite_sync_wait=None,
read_collections=None,
write_collections=None):
write_collections=None,
stream=None,
skip_inaccessible_cols=None):
"""Execute the query and return the result cursor.
:param query: Query to execute.
Expand Down Expand Up @@ -231,7 +233,7 @@ def execute(self,
:type intermediate_commit_size: int
:param satellite_sync_wait: Number of seconds in which the server must
synchronize the satellite collections involved in the query. When
the threshold is reached, the query is stopped. Applies only to
the threshold is reached, the query is stopped. Available only for
enterprise version of ArangoDB.
:type satellite_sync_wait: int | float
:param read_collections: Names of collections read during query
Expand All @@ -240,6 +242,28 @@ def execute(self,
:param write_collections: Names of collections written to during query
execution. Required for :doc:`transactions <transaction>`.
:type write_collections: [str | unicode]
:param stream: If set to True, query is executed in streaming fashion:
query result is not stored server-side but calculated on the fly.
Note: long-running queries hold collection locks for as long as the
cursor exists. If set to False, query is executed right away in its
entirety. Results are either returned right away (if the result set
is small enough), or stored server-side and accessible via cursors
(while respecting the ttl). You should use this parameter only for
short-running queries or without exclusive locks (write-locks on
MMFiles). Note: parameters **cache**, **count** and **full_count**
do not work for streaming queries. Query statistics, warnings and
profiling data are made available only after the query is finished.
Default value is False.
:type stream: bool
:param skip_inaccessible_cols: If set to True, collections without user
access are skipped, and query executes normally instead of raising
an error. This helps certain use cases: a graph may contain several
collections, and users with different access levels may execute the
same query. This parameter lets you limit the result set by user
access. Cannot be used in :doc:`transactions <transaction>` and is
available only for enterprise version of ArangoDB. Default value is
False.
:type skip_inaccessible_cols: bool
:return: Result cursor.
:rtype: arango.cursor.Cursor
:raise arango.exceptions.AQLQueryExecuteError: If execute fails.
Expand Down Expand Up @@ -277,6 +301,11 @@ def execute(self,
options['intermediateCommitSize'] = intermediate_commit_size
if satellite_sync_wait is not None:
options['satelliteSyncWait'] = satellite_sync_wait
if stream is not None:
options['stream'] = stream
if skip_inaccessible_cols is not None:
options['skipInaccessibleCollections'] = skip_inaccessible_cols

if options:
data['options'] = options
data.update(options)
Expand Down
2 changes: 1 addition & 1 deletion arango/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '4.3.0'
__version__ = '4.4.0'
4 changes: 3 additions & 1 deletion tests/test_aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def test_aql_query_management(db, bad_db, col, docs):
intermediate_commit_size=1000,
satellite_sync_wait=False,
write_collections=[col.name],
read_collections=[col.name]
read_collections=[col.name],
stream=False,
skip_inaccessible_cols=True
)
if db.context == 'transaction':
assert cursor.id is None
Expand Down

0 comments on commit 8199148

Please sign in to comment.