API Specification

This page contains the specification for all classes and methods available in python_aioarango.

ArangoClient

class python_aioarango.client.ArangoClient(hosts: typing.Union[str, typing.Sequence[str]] = 'http://127.0.0.1:8529', host_resolver: str = 'roundrobin', http_client: typing.Optional[python_aioarango.http.HTTPClient] = None, serializer: typing.Callable[[...], str] = <function ArangoClient.<lambda>>, deserializer: typing.Callable[[str], typing.Any] = <function ArangoClient.<lambda>>)[source]

ArangoDB client.

Parameters
  • hosts (str | [str]) – Host URL or list of URLs (coordinators in a cluster).

  • host_resolver (str) – Host resolver. This parameter used for clusters (when multiple host URLs are provided). Accepted values are “roundrobin” and “random”. Any other value defaults to round robin.

  • http_client (python_aioarango.http.HTTPClient) – User-defined HTTP client.

  • serializer (callable) – User-defined JSON serializer. Must be a callable which takes a JSON data type object as its only argument and return the serialized string. If not given, json.dumps is used by default.

  • deserializer (callable) – User-defined JSON de-serializer. Must be a callable which takes a JSON serialized string as its only argument and return the de-serialized object. If not given, json.loads is used by default.

property hosts: Sequence[str]

Return the list of ArangoDB host URLs.

Returns

List of ArangoDB host URLs.

Return type

[str]

property version

Return the client version.

Returns

Client version.

Return type

str

async db(name: str = '_system', username: str = 'root', password: str = '', verify: bool = False, auth_method: str = 'basic', superuser_token: Optional[str] = None) python_aioarango.database.StandardDatabase[source]

Connect to an ArangoDB database and return the database API wrapper.

Parameters
  • name (str) – Database name.

  • username (str) – Username for basic authentication.

  • password (str) – Password for basic authentication.

  • verify (bool) – Verify the connection by sending a test request.

  • auth_method (str) – HTTP authentication method. Accepted values are “basic” (default) and “jwt”. If set to “jwt”, the token is refreshed automatically using ArangoDB username and password. This assumes that the clocks of the server and client are synchronized.

  • superuser_token (str) – User generated token for superuser access. If set, parameters username, password and auth_method are ignored. This token is not refreshed automatically.

Returns

Standard database API wrapper.

Return type

python_aioarango.database.StandardDatabase

Raises

python_aioarango.exceptions.ServerConnectionError – If verify was set to True and the connection fails.

AsyncDatabase

class python_aioarango.database.AsyncDatabase(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], return_result: bool)[source]

Database API wrapper tailored specifically for async execution.

See python_aioarango.database.StandardDatabase.begin_async_execution().

Parameters
  • connection – HTTP connection.

  • return_result (bool) – If set to True, API executions return instances of python_aioarango.job.AsyncJob, which you can use to retrieve results from server once available. If set to False, API executions return None and no results are stored on server.

async analyzer(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return analyzer details.

Parameters

name (str) – Analyzer name.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerGetError – If retrieval fails.

async analyzers() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of analyzers.

Returns

List of analyzers.

Return type

[dict]

Raises

python_aioarango.exceptions.AnalyzerListError – If retrieval fails.

property aql: python_aioarango.aql.AQL

Return AQL (ArangoDB Query Language) API wrapper.

Returns

AQL API wrapper.

Return type

python_aioarango.aql.AQL

async async_jobs(status: str, count: Optional[int] = None) Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return IDs of async jobs with given status.

Parameters
  • status (str) – Job status (e.g. “pending”, “done”).

  • count (int) – Max number of job IDs to return.

Returns

List of job IDs.

Return type

[str]

Raises

python_aioarango.exceptions.AsyncJobListError – If retrieval fails.

property backup: python_aioarango.backup.Backup

Return Backup API wrapper.

Returns

Backup API wrapper.

Return type

python_aioarango.backup.Backup

async clear_async_jobs(threshold: Optional[int] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Clear async job results from the server.

Async jobs that are still queued or running are not stopped.

Parameters

threshold (int | None) – If specified, only the job results created prior to the threshold (a unix timestamp) are deleted. Otherwise, all job results are deleted.

Returns

True if job results were cleared successfully.

Return type

bool

Raises

python_aioarango.exceptions.AsyncJobClearError – If operation fails.

property cluster: python_aioarango.cluster.Cluster

Return Cluster API wrapper.

Returns

Cluster API wrapper.

Return type

python_aioarango.cluster.Cluster

collection(name: str) python_aioarango.collection.StandardCollection

Return the standard collection API wrapper.

Parameters

name (str) – Collection name.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

async collections() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return the collections in the database.

Returns

Collections in the database and their details.

Return type

[dict]

Raises

python_aioarango.exceptions.CollectionListError – If retrieval fails.

property conn: Union[BaseConnection, JwtConnection, JwtSuperuserConnection]

Return the HTTP connection.

Returns

HTTP connection.

Return type

python_aioarango.connection.BasicConnection | python_aioarango.connection.JwtConnection | python_aioarango.connection.JwtSuperuserConnection

property context: str

Return the API execution context.

Returns

API execution context. Possible values are “default”, “async”, “batch” and “transaction”.

Return type

str

async create_analyzer(name: str, analyzer_type: str, properties: Optional[Dict[str, Any]] = None, features: Optional[Sequence[str]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an analyzer.

Parameters
  • name (str) – Analyzer name.

  • analyzer_type (str) – Analyzer type.

  • properties (dict | None) – Analyzer properties.

  • features (list | None) – Analyzer features.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerCreateError – If create fails.

async create_arangosearch_view(name: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async create_collection(name: str, sync: bool = False, system: bool = False, edge: bool = False, user_keys: bool = True, key_increment: Optional[int] = None, key_offset: Optional[int] = None, key_generator: str = 'traditional', shard_fields: Optional[Sequence[str]] = None, shard_count: Optional[int] = None, replication_factor: Optional[int] = None, shard_like: Optional[str] = None, sync_replication: Optional[bool] = None, enforce_replication_factor: Optional[bool] = None, sharding_strategy: Optional[str] = None, smart_join_attribute: Optional[str] = None, write_concern: Optional[int] = None, schema: Optional[Dict[str, Any]] = None) Optional[Union[python_aioarango.collection.StandardCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.StandardCollection], python_aioarango.job.BatchJob[python_aioarango.collection.StandardCollection]]]

Create a new collection.

Parameters
  • name (str) – Collection name.

  • sync (bool | None) – If set to True, document operations via the collection will block until synchronized to disk by default.

  • system (bool) – If set to True, a system collection is created. The collection name must have leading underscore “_” character.

  • edge (bool) – If set to True, an edge collection is created.

  • key_generator (str) – Used for generating document keys. Allowed values are “traditional” or “autoincrement”.

  • user_keys (bool) – If set to True, users are allowed to supply document keys. If set to False, the key generator is solely responsible for supplying the key values.

  • key_increment (int) – Key increment value. Applies only when value of key_generator is set to “autoincrement”.

  • key_offset (int) – Key offset value. Applies only when value of key_generator is set to “autoincrement”.

  • shard_fields ([str]) – Field(s) used to determine the target shard.

  • shard_count (int) – Number of shards to create.

  • replication_factor (int) – Number of copies of each shard on different servers in a cluster. Allowed values are 1 (only one copy is kept and no synchronous replication), and n (n-1 replicas are kept and any two copies are replicated across servers synchronously, meaning every write to the master is copied to all slaves before operation is reported successful).

  • shard_like (str) – Name of prototype collection whose sharding specifics are imitated. Prototype collections cannot be dropped before imitating collections. Applies to enterprise version of ArangoDB only.

  • sync_replication (bool) – If set to True, server reports success only when collection is created in all replicas. You can set this to False for faster server response, and if full replication is not a concern.

  • enforce_replication_factor (bool) – Check if there are enough replicas available at creation time, or halt the operation.

  • sharding_strategy (str) – Sharding strategy. Available for ArangoDB version and up only. Possible values are “community-compat”, “enterprise-compat”, “enterprise-smart-edge-compat”, “hash” and “enterprise-hash-smart-edge”. Refer to ArangoDB documentation for more details on each value.

  • smart_join_attribute (str) – Attribute of the collection which must contain the shard key value of the smart join collection. The shard key for the documents must contain the value of this attribute, followed by a colon “:” and the primary key of the document. Requires parameter shard_like to be set to the name of another collection, and parameter shard_fields to be set to a single shard key attribute, with another colon “:” at the end. Available only for enterprise version of ArangoDB.

  • write_concern (int) – Write concern for the collection. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time. The value of this parameter cannot be larger than that of replication_factor. Default value is 1. Used for clusters only.

  • schema (dict) – Optional dict specifying the collection level schema for documents. See ArangoDB documentation for more information on document schema validation.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

Raises

python_aioarango.exceptions.CollectionCreateError – If create fails.

async create_database(name: str, users: Optional[Sequence[Dict[str, Any]]] = None, replication_factor: Optional[Union[int, str]] = None, write_concern: Optional[int] = None, sharding: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Create a new database.

Parameters
  • name (str) – Database name.

  • users ([dict]) – List of users with access to the new database, where each user is a dictionary with fields “username”, “password”, “active” and “extra” (see below for example). If not set, only the admin and current user are granted access.

  • replication_factor (int | str) – Default replication factor for collections created in this database. Special values include “satellite” which replicates the collection to every DBServer, and 1 which disables replication. Used for clusters only.

  • write_concern (int) – Default write concern for collections created in this database. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time, however. Value of this parameter can not be larger than the value of replication_factor. Used for clusters only.

  • sharding (str) – Sharding method used for new collections in this database. Allowed values are: “”, “flexible” and “single”. The first two are equivalent. Used for clusters only.

Returns

True if database was created successfully.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseCreateError – If create fails.

Here is an example entry for parameter users:

{
    'username': 'john',
    'password': 'password',
    'active': True,
    'extra': {'Department': 'IT'}
}
async create_graph(name: str, edge_definitions: Optional[Sequence[Dict[str, Any]]] = None, orphan_collections: Optional[Sequence[str]] = None, smart: Optional[bool] = None, smart_field: Optional[str] = None, shard_count: Optional[int] = None) Optional[Union[python_aioarango.graph.Graph, python_aioarango.job.AsyncJob[python_aioarango.graph.Graph], python_aioarango.job.BatchJob[python_aioarango.graph.Graph]]]

Create a new graph.

Parameters
  • name (str) – Graph name.

  • edge_definitions ([dict] | None) – List of edge definitions, where each edge definition entry is a dictionary with fields “edge_collection”, “from_vertex_collections” and “to_vertex_collections” (see below for example).

  • orphan_collections ([str] | None) – Names of additional vertex collections that are not in edge definitions.

  • smart (bool | None) – If set to True, sharding is enabled (see parameter smart_field below). Applies only to enterprise version of ArangoDB.

  • smart_field (str | None) – Document field used to shard the vertices of the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. Applies only to enterprise version of ArangoDB.

  • shard_count (int | None) – Number of shards used for every collection in the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. This number cannot be modified later once set. Applies only to enterprise version of ArangoDB.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

Raises

python_aioarango.exceptions.GraphCreateError – If create fails.

Here is an example entry for parameter edge_definitions:

{
    'edge_collection': 'teach',
    'from_vertex_collections': ['teachers'],
    'to_vertex_collections': ['lectures']
}
async create_task(name: str, command: str, params: Optional[Dict[str, Any]] = None, period: Optional[int] = None, offset: Optional[int] = None, task_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new server task.

Parameters
  • name (str) – Name of the server task.

  • command (str) – Javascript command to execute.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • period (int | None) – Number of seconds to wait between executions. If set to 0, the new task will be “timed”, meaning it will execute only once and be deleted afterwards.

  • offset (int | None) – Initial delay before execution in seconds.

  • task_id (str | None) – Pre-defined ID for the new server task.

Returns

Details of the new task.

Return type

dict

Raises

python_aioarango.exceptions.TaskCreateError – If create fails.

async create_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new user.

Parameters
  • username (str) – Username.

  • password (str | None) – Password.

  • active (bool | None) – True if user is active, False otherwise.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserCreateError – If create fails.

async create_view(name: str, view_type: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async databases() Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return the names all databases.

Returns

Database names.

Return type

[str]

Raises

python_aioarango.exceptions.DatabaseListError – If retrieval fails.

property db_name: str

Return the name of the current database.

Returns

Database name.

Return type

str

async delete_analyzer(name: str, force: bool = False, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete an analyzer.

Parameters
  • name (str) – Analyzer name.

  • force (bool) – Remove the analyzer configuration even if in use.

  • ignore_missing (bool) – Do not raise an exception on missing analyzer.

Returns

True if analyzer was deleted successfully, False if analyzer was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.AnalyzerDeleteError – If delete fails.

async delete_collection(name: str, ignore_missing: bool = False, system: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the collection.

Parameters
  • name (str) – Collection name.

  • ignore_missing (bool) – Do not raise an exception on missing collection.

  • system (bool) – Whether the collection is a system collection.

Returns

True if collection was deleted successfully, False if collection was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.CollectionDeleteError – If delete fails.

async delete_database(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the database.

Parameters
  • name (str) – Database name.

  • ignore_missing (bool) – Do not raise an exception on missing database.

Returns

True if database was deleted successfully, False if database was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseDeleteError – If delete fails.

async delete_document(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Delete a document.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision), or True if parameter silent was set to True, or False if document was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool | dict

Raises
async delete_graph(name: str, ignore_missing: bool = False, drop_collections: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Drop the graph of the given name from the database.

Parameters
  • name (str) – Graph name.

  • ignore_missing (bool) – Do not raise an exception on missing graph.

  • drop_collections (bool | None) – Drop the collections of the graph also. This is only if they are not in use by other graphs.

Returns

True if graph was deleted successfully, False if graph was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.GraphDeleteError – If delete fails.

async delete_task(task_id: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a server task.

Parameters
  • task_id (str) – Server task ID.

  • ignore_missing (bool) – Do not raise an exception on missing task.

Returns

True if task was successfully deleted, False if task was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.TaskDeleteError – If delete fails.

async delete_user(username: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a user.

Parameters
  • username (str) – Username.

  • ignore_missing (bool) – Do not raise an exception on missing user.

Returns

True if user was deleted successfully, False if user was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.UserDeleteError – If delete fails.

async delete_view(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a view.

Parameters
  • name (str) – View name.

  • ignore_missing (bool) – Do not raise an exception on missing view.

Returns

True if view was deleted successfully, False if view was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.ViewDeleteError – If delete fails.

async details() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server details.

Returns

Server details.

Return type

dict

Raises

python_aioarango.exceptions.ServerDetailsError – If retrieval fails.

async document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]]

Return a document.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

Document, or None if not found.

Return type

dict | None

Raises
async echo() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return details of the last request (e.g. headers, payload).

Returns

Details of the last request.

Return type

dict

Raises

python_aioarango.exceptions.ServerEchoError – If retrieval fails.

async encryption() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Rotate the user-supplied keys for encryption.

This method is available only for enterprise edition of ArangoDB.

Returns

New TLS data.

Return type

dict

Raises

python_aioarango.exceptions.ServerEncryptionError – If retrieval fails.

async engine() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the database engine details.

Returns

Database engine details.

Return type

dict

Raises

python_aioarango.exceptions.ServerEngineError – If retrieval fails.

async execute_transaction(command: str, params: Optional[Dict[str, Any]] = None, read: Optional[Sequence[str]] = None, write: Optional[Sequence[str]] = None, sync: Optional[bool] = None, timeout: Optional[numbers.Number] = None, max_size: Optional[int] = None, allow_implicit: Optional[bool] = None, intermediate_commit_count: Optional[int] = None, intermediate_commit_size: Optional[int] = None) Optional[Union[Any, python_aioarango.job.AsyncJob[Any], python_aioarango.job.BatchJob[Any]]]

Execute raw Javascript command in transaction.

Parameters
  • command (str) – Javascript command to execute.

  • read ([str] | None) – Names of collections read during transaction. If parameter allow_implicit is set to True, any undeclared read collections are loaded lazily.

  • write ([str] | None) – Names of collections written to during transaction. Transaction fails on undeclared write collections.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • timeout (int | None) – Timeout for waiting on collection locks. If set to 0, ArangoDB server waits indefinitely. If not set, system default value is used.

  • max_size (int | None) – Max transaction size limit in bytes.

  • allow_implicit (bool | None) – If set to True, undeclared read collections are loaded lazily. If set to False, transaction fails on any undeclared collections.

  • intermediate_commit_count (int | None) – Max number of operations after which an intermediate commit is performed automatically.

  • intermediate_commit_size (int | None) – Max size of operations in bytes after which an intermediate commit is performed automatically.

Returns

Return value of command.

Return type

Any

Raises

python_aioarango.exceptions.TransactionExecuteError – If execution fails.

property foxx: python_aioarango.foxx.Foxx

Return Foxx API wrapper.

Returns

Foxx API wrapper.

Return type

python_aioarango.foxx.Foxx

graph(name: str) python_aioarango.graph.Graph

Return the graph API wrapper.

Parameters

name (str) – Graph name.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

async graphs() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

List all graphs in the database.

Returns

Graphs in the database.

Return type

[dict]

Raises

python_aioarango.exceptions.GraphListError – If retrieval fails.

async has_collection(name)

Check if collection exists in the database.

Parameters

name (str) – Collection name.

Returns

True if collection exists, False otherwise.

Return type

bool

async has_database(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a database exists.

Parameters

name (str) – Database name.

Returns

True if database exists, False otherwise.

Return type

bool

async has_document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a document exists.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

True if document exists, False otherwise.

Return type

bool

Raises
async has_graph(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a graph exists in the database.

Parameters

name (str | unicode) – Graph name.

Returns

True if graph exists, False otherwise.

Return type

bool

async has_user(username: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if user exists.

Parameters

username (str) – Username.

Returns

True if user exists, False otherwise.

Return type

bool

async insert_document(collection: str, document: Dict[str, Any], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False, overwrite_mode: Optional[str] = None, keep_none: Optional[bool] = None, merge: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Insert a new document.

Parameters
  • collection (str) – Collection name.

  • document (dict) – Document to insert. If it contains the “_key” or “_id” field, the value is used as the key of the new document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate key and the existing document is replaced.

  • return_old (bool) – Include body of the old document if replaced. Applies only when value of overwrite is set to True.

  • overwrite_mode (str | None) – Overwrite behavior used when the document key exists already. Allowed values are “replace” (replace-insert) or “update” (update-insert). Implicitly sets the value of parameter overwrite.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely. Applies only when overwrite_mode is set to “update” (update-insert).

  • merge (bool | None) – If set to True (default), sub-dictionaries are merged instead of the new one overwriting the old one. Applies only when overwrite_mode is set to “update” (update-insert).

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return information on currently loaded JWT secrets.

Returns

Information on currently loaded JWT secrets.

Return type

dict

async log_levels() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return current logging levels.

Returns

Current logging levels.

Return type

dict

async metrics() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server metrics in Prometheus format.

Returns

Server metrics in Prometheus format.

Return type

str

property name: str

Return database name.

Returns

Database name.

Return type

str

async permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

Permission for given database or collection.

Return type

str

Raises

python_aioarango.exceptions.PermissionGetError – If retrieval fails.

async permissions(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user permissions for all databases and collections.

Parameters

username (str) – Username.

Returns

User permissions for all databases and collections.

Return type

dict

Raises

python_aioarango.exceptions.PermissionListError – If retrieval fails.

property pregel: python_aioarango.pregel.Pregel

Return Pregel API wrapper.

Returns

Pregel API wrapper.

Return type

python_aioarango.pregel.Pregel

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return database properties.

Returns

Database properties.

Return type

dict

Raises

python_aioarango.exceptions.DatabasePropertiesError – If retrieval fails.

async read_log(upto: Optional[Union[int, str]] = None, level: Optional[Union[int, str]] = None, start: Optional[int] = None, size: Optional[int] = None, offset: Optional[int] = None, search: Optional[str] = None, sort: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Read the global log from server.

Parameters
  • upto (int | str) – Return the log entries up to the given level (mutually exclusive with parameter level). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • level (int | str) – Return the log entries of only the given level (mutually exclusive with upto). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • start (int) – Return the log entries whose ID is greater or equal to the given value.

  • size (int) – Restrict the size of the result to the given value. This can be used for pagination.

  • offset (int) – Number of entries to skip (e.g. for pagination).

  • search (str) – Return only the log entries containing the given text.

  • sort (str) – Sort the log entries according to the given fashion, which can be “sort” or “desc”.

Returns

Server log entries.

Return type

dict

Raises

python_aioarango.exceptions.ServerReadLogError – If read fails.

async reload_jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Hot-reload JWT secrets.

Calling this without payload reloads JWT secrets from disk. Only files specified via arangod startup option --server.jwt-secret-keyfile or --server.jwt-secret-folder are used. It is not possible to change the location where files are loaded from without restarting the server.

Returns

Information on reloaded JWT secrets.

Return type

dict

async reload_routing() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reload the routing information.

Returns

True if routing was reloaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerReloadRoutingError – If reload fails.

async reload_tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Reload TLS data (server key, client-auth CA).

Returns

New TLS data.

Return type

dict

async rename_view(name: str, new_name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Rename a view.

Parameters
  • name (str) – View name.

  • new_name (str) – New view name.

Returns

True if view was renamed successfully.

Return type

bool

Raises

python_aioarango.exceptions.ViewRenameError – If delete fails.

async replace_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

async replace_document(document: Dict[str, Any], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Replace a document.

Parameters
  • document (dict) – New document to replace the old one with. It must contain the “_id” field. Edge document must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace_user(username: str, password: str, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a user.

Parameters
  • username (str) – Username.

  • password (str) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserReplaceError – If replace fails.

async replace_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

property replication: python_aioarango.replication.Replication

Return Replication API wrapper.

Returns

Replication API wrapper.

Return type

python_aioarango.replication.Replication

async required_db_version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return required version of target database.

Returns

Required version of target database.

Return type

str

Raises

python_aioarango.exceptions.ServerRequiredDBVersionError – If retrieval fails.

async reset_permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reset user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str) – Collection name.

Returns

True if permission was reset successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionRestError – If reset fails.

async role() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server role.

Returns

Server role. Possible values are “SINGLE” (server which is not in a cluster), “COORDINATOR” (cluster coordinator), “PRIMARY”, “SECONDARY”, “AGENT” (Agency node in a cluster) or “UNDEFINED”.

Return type

str

Raises

python_aioarango.exceptions.ServerRoleError – If retrieval fails.

async run_tests(tests: Sequence[str]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Run available unittests on the server.

Parameters

tests ([str]) – List of files containing the test suites.

Returns

Test results.

Return type

dict

Raises

python_aioarango.exceptions.ServerRunTestsError – If execution fails.

async set_log_levels(**kwargs: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Set the logging levels.

This method takes arbitrary keyword arguments where the keys are the logger names and the values are the logging levels. For example:

python_aioarango.set_log_levels(
    agency='DEBUG',
    collector='INFO',
    threads='WARNING'
)

Keys that are not valid logger names are ignored.

Returns

New logging levels.

Return type

dict

async shutdown() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Initiate server shutdown sequence.

Returns

True if the server was shutdown successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerShutdownError – If shutdown fails.

async statistics(description: bool = False) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return server statistics.

Returns

Server statistics.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatisticsError – If retrieval fails.

async status() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server status.

Returns

Server status.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatusError – If retrieval fails.

async task(task_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the details of an active server task.

Parameters

task_id (str) – Server task ID.

Returns

Server task details.

Return type

dict

Raises

python_aioarango.exceptions.TaskGetError – If retrieval fails.

async tasks() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all currently active server tasks.

Returns

Currently active server tasks.

Return type

[dict]

Raises

python_aioarango.exceptions.TaskListError – If retrieval fails.

async time() Optional[Union[datetime.datetime, python_aioarango.job.AsyncJob[datetime.datetime], python_aioarango.job.BatchJob[datetime.datetime]]]

Return server system time.

Returns

Server system time.

Return type

datetime.datetime

Raises

python_aioarango.exceptions.ServerTimeError – If retrieval fails.

async tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return TLS data (server key, client-auth CA).

Returns

TLS data.

Return type

dict

async update_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async update_document(document: Dict[str, Any], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Update a document.

Parameters
  • document (dict) – Partial or full document with the updated values. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new one overwriting the old one.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async update_permission(username: str, permission: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Update user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • permission (str) – Allowed values are “rw” (read and write), “ro” (read only) or “none” (no access).

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

True if access was granted successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionUpdateError – If update fails.

async update_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a user.

Parameters
  • username (str) – Username.

  • password (str | None) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserUpdateError – If update fails.

async update_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async user(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user details.

Parameters

username (str) – Username.

Returns

User details.

Return type

dict

Raises

python_aioarango.exceptions.UserGetError – If retrieval fails.

property username: Optional[str]

Return the username.

Returns

Username.

Return type

str

async users() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all user details.

Returns

List of user details.

Return type

[dict]

Raises

python_aioarango.exceptions.UserListError – If retrieval fails.

async version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return ArangoDB server version.

Returns

Server version.

Return type

str

Raises

python_aioarango.exceptions.ServerVersionError – If retrieval fails.

async view(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return view details.

Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewGetError – If retrieval fails.

async views() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of views and their summaries.

Returns

List of views.

Return type

[dict]

Raises

python_aioarango.exceptions.ViewListError – If retrieval fails.

property wal: python_aioarango.wal.WAL

Return WAL (Write-Ahead Log) API wrapper.

Returns

WAL API wrapper.

Return type

python_aioarango.wal.WAL

AsyncJob

class python_aioarango.job.AsyncJob(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], job_id: str, response_handler: Callable[[python_aioarango.response.Response], python_aioarango.job.T])[source]

Job for tracking and retrieving result of an async API execution.

Parameters
  • connection – HTTP connection.

  • job_id (str) – Async job ID.

  • response_handler (callable) – HTTP response handler.

property id: str

Return the async job ID.

Returns

Async job ID.

Return type

str

async status()[source]

Return the async job status from server.

Once a job result is retrieved via func:python_aioarango.job.AsyncJob.result method, it is deleted from server and subsequent status queries will fail.

Returns

Async job status. Possible values are “pending” (job is still in queue), “done” (job finished or raised an error), or “cancelled” (job was cancelled before completion).

Return type

str

Raises

python_aioarango.exceptions.AsyncJobStatusError – If retrieval fails.

async result()[source]

Return the async job result from server.

If the job raised an exception, it is propagated up at this point.

Once job result is retrieved, it is deleted from server and subsequent queries for result will fail.

Returns

Async job result.

Raises
async cancel(ignore_missing: bool = False) bool[source]

Cancel the async job.

An async job cannot be cancelled once it is taken out of the queue.

Parameters

ignore_missing (bool) – Do not raise an exception on missing job.

Returns

True if job was cancelled successfully, False if the job was not found but ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.AsyncJobCancelError – If cancel fails.

async clear(ignore_missing: bool = False) bool[source]

Delete the job result from the server.

Parameters

ignore_missing (bool) – Do not raise an exception on missing job.

Returns

True if result was deleted successfully, False if the job was not found but ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.AsyncJobClearError – If delete fails.

AQL

class python_aioarango.aql.AQL(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]

AQL (ArangoDB Query Language) API wrapper.

Parameters
  • connection – HTTP connection.

  • executor – API executor.

property cache: python_aioarango.aql.AQLQueryCache

Return the query cache API wrapper.

Returns

Query cache API wrapper.

Return type

python_aioarango.aql.AQLQueryCache

async explain(query: str, all_plans: bool = False, max_plans: Optional[int] = None, opt_rules: Optional[Sequence[str]] = None, bind_vars: Optional[MutableMapping[str, str]] = None) Optional[Union[Dict[str, Any], List[Dict[str, Any]], python_aioarango.job.AsyncJob[Union[Dict[str, Any], List[Dict[str, Any]]]], python_aioarango.job.BatchJob[Union[Dict[str, Any], List[Dict[str, Any]]]]]][source]

Inspect the query and return its metadata without executing it.

Parameters
  • query (str) – Query to inspect.

  • all_plans (bool) – If set to True, all possible execution plans are returned in the result. If set to False, only the optimal plan is returned.

  • max_plans (int) – Total number of plans generated by the optimizer.

  • opt_rules (list) – List of optimizer rules.

  • bind_vars (dict) – Bind variables for the query.

Returns

Execution plan, or plans if all_plans was set to True.

Return type

dict | list

Raises

python_aioarango.exceptions.AQLQueryExplainError – If explain fails.

async validate(query: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Parse and validate the query without executing it.

Parameters

query (str) – Query to validate.

Returns

Query details.

Return type

dict

Raises

python_aioarango.exceptions.AQLQueryValidateError – If validation fails.

async execute(query: str, count: bool = False, batch_size: Optional[int] = None, ttl: Optional[numbers.Number] = None, bind_vars: Optional[MutableMapping[str, str]] = None, full_count: Optional[bool] = None, max_plans: Optional[int] = None, optimizer_rules: Optional[Sequence[str]] = None, cache: Optional[bool] = None, memory_limit: int = 0, fail_on_warning: Optional[bool] = None, profile: Optional[bool] = None, max_transaction_size: Optional[int] = None, max_warning_count: Optional[int] = None, intermediate_commit_count: Optional[int] = None, intermediate_commit_size: Optional[int] = None, satellite_sync_wait: Optional[int] = None, stream: Optional[bool] = None, skip_inaccessible_cols: Optional[bool] = None, max_runtime: Optional[numbers.Number] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Execute the query and return the result cursor.

Parameters
  • query (str) – Query to execute.

  • count (bool) – If set to True, the total document count is included in the result cursor.

  • batch_size (int) – Number of documents fetched by the cursor in one round trip.

  • ttl (int) – Server side time-to-live for the cursor in seconds.

  • bind_vars (dict) – Bind variables for the query.

  • full_count (bool) – This parameter applies only to queries with LIMIT clauses. If set to True, the number of matched documents before the last LIMIT clause executed is included in the cursor. This is similar to MySQL SQL_CALC_FOUND_ROWS hint. Using this disables a few LIMIT optimizations and may lead to a longer query execution.

  • max_plans (int) – Max number of plans the optimizer generates.

  • optimizer_rules ([str]) – List of optimizer rules.

  • cache (bool) – If set to True, the query cache is used. The operation mode of the query cache must be set to “on” or “demand”.

  • memory_limit (int) – Max amount of memory the query is allowed to use in bytes. If the query goes over the limit, it fails with error “resource limit exceeded”. Value 0 indicates no limit.

  • fail_on_warning (bool) – If set to True, the query throws an exception instead of producing a warning. This parameter can be used during development to catch issues early. If set to False, warnings are returned with the query result. There is a server configuration option “–query.fail-on-warning” for setting the default value for this behaviour so it does not need to be set per-query.

  • profile (bool) – Return additional profiling details in the cursor, unless the query cache is used.

  • max_transaction_size (int) – Transaction size limit in bytes.

  • max_warning_count (int) – Max number of warnings returned.

  • intermediate_commit_count (int) – Max number of operations after which an intermediate commit is performed automatically.

  • intermediate_commit_size (int) – Max size of operations in bytes after which an intermediate commit is performed automatically.

  • satellite_sync_wait (int | float) – 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. Available only for enterprise version of ArangoDB.

  • stream (bool) – 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. 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.

  • skip_inaccessible_cols (bool) – 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 transactions and is available only for enterprise version of ArangoDB. Default value is False.

  • max_runtime (int | float) – Query must be executed within this given timeout or it is killed. The value is specified in seconds. Default value is 0.0 (no timeout).

Returns

Result cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.AQLQueryExecuteError – If execute fails.

async kill(query_id: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Kill a running query.

Parameters

query_id (str) – Query ID.

Returns

True if kill request was sent successfully.

Return type

bool

Raises

python_aioarango.exceptions.AQLQueryKillError – If the send fails.

async queries() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

Return the currently running AQL queries.

Returns

Running AQL queries.

Return type

[dict]

Raises

python_aioarango.exceptions.AQLQueryListError – If retrieval fails.

async slow_queries() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

Return a list of all slow AQL queries.

Returns

Slow AQL queries.

Return type

[dict]

Raises

python_aioarango.exceptions.AQLQueryListError – If retrieval fails.

async clear_slow_queries() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Clear slow AQL queries.

Returns

True if slow queries were cleared successfully.

Return type

bool

Raises

python_aioarango.exceptions.AQLQueryClearError – If operation fails.

async tracking() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return AQL query tracking properties.

Returns

AQL query tracking properties.

Return type

dict

Raises

python_aioarango.exceptions.AQLQueryTrackingGetError – If retrieval fails.

async set_tracking(enabled: Optional[bool] = None, max_slow_queries: Optional[int] = None, slow_query_threshold: Optional[int] = None, max_query_string_length: Optional[int] = None, track_bind_vars: Optional[bool] = None, track_slow_queries: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Configure AQL query tracking properties

Parameters
  • enabled (bool) – Track queries if set to True.

  • max_slow_queries (int) – Max number of slow queries to track. Oldest entries are discarded first.

  • slow_query_threshold (int) – Runtime threshold (in seconds) for treating a query as slow.

  • max_query_string_length (int) – Max query string length (in bytes) tracked.

  • track_bind_vars (bool) – If set to True, track bind variables used in queries.

  • track_slow_queries (bool) – If set to True, track slow queries whose runtimes exceed slow_query_threshold. To use this, parameter enabled must be set to True.

Returns

Updated AQL query tracking properties.

Return type

dict

Raises

python_aioarango.exceptions.AQLQueryTrackingSetError – If operation fails.

async functions() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

List the AQL functions defined in the database.

Returns

AQL functions.

Return type

[dict]

Raises

python_aioarango.exceptions.AQLFunctionListError – If retrieval fails.

async create_function(name: str, code: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new AQL function.

Parameters
  • name (str) – AQL function name.

  • code (str) – Function definition in Javascript.

Returns

Whether the AQL function was newly created or an existing one was replaced.

Return type

dict

Raises

python_aioarango.exceptions.AQLFunctionCreateError – If create fails.

async delete_function(name: str, group: bool = False, ignore_missing: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Delete an AQL function.

Parameters
  • name (str) – AQL function name.

  • group (bool) – If set to True, value of parameter name is treated as a namespace prefix, and all functions in the namespace are deleted. If set to False, the value of name must be a fully qualified function name including any namespaces.

  • ignore_missing (bool) – Do not raise an exception on missing function.

Returns

Number of AQL functions deleted if operation was successful, False if function(s) was not found and ignore_missing was set to True.

Return type

dict | bool

Raises

python_aioarango.exceptions.AQLFunctionDeleteError – If delete fails.

AQLQueryCache

class python_aioarango.aql.AQLQueryCache(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]

AQL Query Cache API wrapper.

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the query cache properties.

Returns

Query cache properties.

Return type

dict

Raises

python_aioarango.exceptions.AQLCachePropertiesError – If retrieval fails.

async configure(mode: Optional[str] = None, max_results: Optional[int] = None, max_results_size: Optional[int] = None, max_entry_size: Optional[int] = None, include_system: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Configure the query cache properties.

Parameters
  • mode (str) – Operation mode. Allowed values are “off”, “on” and “demand”.

  • max_results (int) – Max number of query results stored per database-specific cache.

  • max_results_size (int) – Max cumulative size of query results stored per database-specific cache.

  • max_entry_size (int) – Max entry size of each query result stored per database-specific cache.

  • include_system (bool) – Store results of queries in system collections.

Returns

Query cache properties.

Return type

dict

Raises

python_aioarango.exceptions.AQLCacheConfigureError – If operation fails.

async entries() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

Return the query cache entries.

Returns

Query cache entries.

Return type

[dict]

Raises

AQLCacheEntriesError – If retrieval fails.

async clear() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Clear the query cache.

Returns

True if query cache was cleared successfully.

Return type

bool

Raises

python_aioarango.exceptions.AQLCacheClearError – If operation fails.

Backup

class python_aioarango.backup.Backup(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]
async get(backup_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return backup details.

Parameters

backup_id (str) – If set, details on only the specified backup is returned. Otherwise details on all backups are returned.

Returns

Backup details.

Return type

dict

Raises

python_aioarango.exceptions.BackupGetError – If delete fails.

async create(label: Optional[str] = None, allow_inconsistent: Optional[bool] = None, force: Optional[bool] = None, timeout: Optional[numbers.Number] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a backup when the global write lock can be obtained.

Parameters
  • label (str) – Backup label. If not given, a UUID is used.

  • allow_inconsistent (bool) – Allow inconsistent backup when the global transaction lock cannot be acquired before timeout. Default value is False.

  • force (bool) – Forcefully abort all running transactions to ensure a consistent backup when the global transaction lock cannot be acquired before timeout. Default (and highly recommended) value is False.

  • timeout (int) – Timeout in seconds for creating the backup. Default value is 120 seconds.

Returns

Result of the create operation.

Return type

dict

Raises

python_aioarango.exceptions.BackupCreateError – If create fails.

async delete(backup_id: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Delete a backup.

Parameters

backup_id (str) – Backup ID.

Returns

True if the backup was deleted successfully.

Return type

bool

Raises

python_aioarango.exceptions.BackupDeleteError – If delete fails.

async download(backup_id: Optional[str] = None, repository: Optional[str] = None, abort: Optional[bool] = None, config: Optional[Dict[str, Any]] = None, download_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Manage backup downloads.

Parameters
  • backup_id (str) – Backup ID used for scheduling a download. Mutually exclusive with parameter download_id.

  • repository (str) – Remote repository URL (e.g. “local://tmp/backups”). Required for scheduling a download and mutually exclusive with parameter download_id.

  • abort (bool) – If set to True, running download is aborted. Used with parameter download_id.

  • config (dict) – Remote repository configuration. Required for scheduling a download and mutually exclusive with parameter download_id.

  • download_id (str) – Download ID. Mutually exclusive with parameters backup_id, repository, and config.

Returns

Download details.

Return type

dict

Raises

python_aioarango.exceptions.BackupDownloadError – If operation fails.

async upload(backup_id: Optional[str] = None, repository: Optional[str] = None, abort: Optional[bool] = None, config: Optional[Dict[str, Any]] = None, upload_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Manage backup uploads.

Parameters
  • backup_id (str) – Backup ID used for scheduling an upload. Mutually exclusive with parameter upload_id.

  • repository (str) – Remote repository URL (e.g. “local://tmp/backups”). Required for scheduling a upload and mutually exclusive with parameter upload_id.

  • config (dict) – Remote repository configuration. Required for scheduling an upload and mutually exclusive with parameter upload_id.

  • upload_id (str) – Upload ID. Mutually exclusive with parameters backup_id, repository, and config.

  • abort (bool) – If set to True, running upload is aborted. Used with parameter upload_id.

Returns

Upload details.

Return type

dict

Raises

python_aioarango.exceptions.BackupUploadError – If upload operation fails.

async restore(backup_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Restore from a local backup.

Parameters

backup_id (str) – Backup ID.

Returns

Result of the restore operation.

Return type

dict

Raises

python_aioarango.exceptions.BackupRestoreError – If restore fails.

property conn: Union[BaseConnection, JwtConnection, JwtSuperuserConnection]

Return the HTTP connection.

Returns

HTTP connection.

Return type

python_aioarango.connection.BasicConnection | python_aioarango.connection.JwtConnection | python_aioarango.connection.JwtSuperuserConnection

property context: str

Return the API execution context.

Returns

API execution context. Possible values are “default”, “async”, “batch” and “transaction”.

Return type

str

property db_name: str

Return the name of the current database.

Returns

Database name.

Return type

str

property username: Optional[str]

Return the username.

Returns

Username.

Return type

str

BatchDatabase

class python_aioarango.database.BatchDatabase(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], return_result: bool)[source]

Database API wrapper tailored specifically for batch execution.

See python_aioarango.database.StandardDatabase.begin_batch_execution().

Parameters
  • connection – HTTP connection.

  • return_result (bool) – If set to True, API executions return instances of python_aioarango.job.BatchJob that are populated with results on commit. If set to False, API executions return None and no results are tracked client-side.

queued_jobs() Optional[Sequence[python_aioarango.job.BatchJob[Any]]][source]

Return the queued batch jobs.

Returns

Queued batch jobs or None if return_result parameter was set to False during initialization.

Return type

[python_aioarango.job.BatchJob] | None

async commit() Optional[Sequence[python_aioarango.job.BatchJob[Any]]][source]

Execute the queued requests in a single batch API request.

If return_result parameter was set to True during initialization, python_aioarango.job.BatchJob instances are populated with results.

Returns

Batch jobs, or None if return_result parameter was set to False during initialization.

Return type

[python_aioarango.job.BatchJob] | None

Raises
async analyzer(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return analyzer details.

Parameters

name (str) – Analyzer name.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerGetError – If retrieval fails.

async analyzers() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of analyzers.

Returns

List of analyzers.

Return type

[dict]

Raises

python_aioarango.exceptions.AnalyzerListError – If retrieval fails.

property aql: python_aioarango.aql.AQL

Return AQL (ArangoDB Query Language) API wrapper.

Returns

AQL API wrapper.

Return type

python_aioarango.aql.AQL

async async_jobs(status: str, count: Optional[int] = None) Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return IDs of async jobs with given status.

Parameters
  • status (str) – Job status (e.g. “pending”, “done”).

  • count (int) – Max number of job IDs to return.

Returns

List of job IDs.

Return type

[str]

Raises

python_aioarango.exceptions.AsyncJobListError – If retrieval fails.

property backup: python_aioarango.backup.Backup

Return Backup API wrapper.

Returns

Backup API wrapper.

Return type

python_aioarango.backup.Backup

async clear_async_jobs(threshold: Optional[int] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Clear async job results from the server.

Async jobs that are still queued or running are not stopped.

Parameters

threshold (int | None) – If specified, only the job results created prior to the threshold (a unix timestamp) are deleted. Otherwise, all job results are deleted.

Returns

True if job results were cleared successfully.

Return type

bool

Raises

python_aioarango.exceptions.AsyncJobClearError – If operation fails.

property cluster: python_aioarango.cluster.Cluster

Return Cluster API wrapper.

Returns

Cluster API wrapper.

Return type

python_aioarango.cluster.Cluster

collection(name: str) python_aioarango.collection.StandardCollection

Return the standard collection API wrapper.

Parameters

name (str) – Collection name.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

async collections() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return the collections in the database.

Returns

Collections in the database and their details.

Return type

[dict]

Raises

python_aioarango.exceptions.CollectionListError – If retrieval fails.

property conn: Union[BaseConnection, JwtConnection, JwtSuperuserConnection]

Return the HTTP connection.

Returns

HTTP connection.

Return type

python_aioarango.connection.BasicConnection | python_aioarango.connection.JwtConnection | python_aioarango.connection.JwtSuperuserConnection

property context: str

Return the API execution context.

Returns

API execution context. Possible values are “default”, “async”, “batch” and “transaction”.

Return type

str

async create_analyzer(name: str, analyzer_type: str, properties: Optional[Dict[str, Any]] = None, features: Optional[Sequence[str]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an analyzer.

Parameters
  • name (str) – Analyzer name.

  • analyzer_type (str) – Analyzer type.

  • properties (dict | None) – Analyzer properties.

  • features (list | None) – Analyzer features.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerCreateError – If create fails.

async create_arangosearch_view(name: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async create_collection(name: str, sync: bool = False, system: bool = False, edge: bool = False, user_keys: bool = True, key_increment: Optional[int] = None, key_offset: Optional[int] = None, key_generator: str = 'traditional', shard_fields: Optional[Sequence[str]] = None, shard_count: Optional[int] = None, replication_factor: Optional[int] = None, shard_like: Optional[str] = None, sync_replication: Optional[bool] = None, enforce_replication_factor: Optional[bool] = None, sharding_strategy: Optional[str] = None, smart_join_attribute: Optional[str] = None, write_concern: Optional[int] = None, schema: Optional[Dict[str, Any]] = None) Optional[Union[python_aioarango.collection.StandardCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.StandardCollection], python_aioarango.job.BatchJob[python_aioarango.collection.StandardCollection]]]

Create a new collection.

Parameters
  • name (str) – Collection name.

  • sync (bool | None) – If set to True, document operations via the collection will block until synchronized to disk by default.

  • system (bool) – If set to True, a system collection is created. The collection name must have leading underscore “_” character.

  • edge (bool) – If set to True, an edge collection is created.

  • key_generator (str) – Used for generating document keys. Allowed values are “traditional” or “autoincrement”.

  • user_keys (bool) – If set to True, users are allowed to supply document keys. If set to False, the key generator is solely responsible for supplying the key values.

  • key_increment (int) – Key increment value. Applies only when value of key_generator is set to “autoincrement”.

  • key_offset (int) – Key offset value. Applies only when value of key_generator is set to “autoincrement”.

  • shard_fields ([str]) – Field(s) used to determine the target shard.

  • shard_count (int) – Number of shards to create.

  • replication_factor (int) – Number of copies of each shard on different servers in a cluster. Allowed values are 1 (only one copy is kept and no synchronous replication), and n (n-1 replicas are kept and any two copies are replicated across servers synchronously, meaning every write to the master is copied to all slaves before operation is reported successful).

  • shard_like (str) – Name of prototype collection whose sharding specifics are imitated. Prototype collections cannot be dropped before imitating collections. Applies to enterprise version of ArangoDB only.

  • sync_replication (bool) – If set to True, server reports success only when collection is created in all replicas. You can set this to False for faster server response, and if full replication is not a concern.

  • enforce_replication_factor (bool) – Check if there are enough replicas available at creation time, or halt the operation.

  • sharding_strategy (str) – Sharding strategy. Available for ArangoDB version and up only. Possible values are “community-compat”, “enterprise-compat”, “enterprise-smart-edge-compat”, “hash” and “enterprise-hash-smart-edge”. Refer to ArangoDB documentation for more details on each value.

  • smart_join_attribute (str) – Attribute of the collection which must contain the shard key value of the smart join collection. The shard key for the documents must contain the value of this attribute, followed by a colon “:” and the primary key of the document. Requires parameter shard_like to be set to the name of another collection, and parameter shard_fields to be set to a single shard key attribute, with another colon “:” at the end. Available only for enterprise version of ArangoDB.

  • write_concern (int) – Write concern for the collection. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time. The value of this parameter cannot be larger than that of replication_factor. Default value is 1. Used for clusters only.

  • schema (dict) – Optional dict specifying the collection level schema for documents. See ArangoDB documentation for more information on document schema validation.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

Raises

python_aioarango.exceptions.CollectionCreateError – If create fails.

async create_database(name: str, users: Optional[Sequence[Dict[str, Any]]] = None, replication_factor: Optional[Union[int, str]] = None, write_concern: Optional[int] = None, sharding: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Create a new database.

Parameters
  • name (str) – Database name.

  • users ([dict]) – List of users with access to the new database, where each user is a dictionary with fields “username”, “password”, “active” and “extra” (see below for example). If not set, only the admin and current user are granted access.

  • replication_factor (int | str) – Default replication factor for collections created in this database. Special values include “satellite” which replicates the collection to every DBServer, and 1 which disables replication. Used for clusters only.

  • write_concern (int) – Default write concern for collections created in this database. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time, however. Value of this parameter can not be larger than the value of replication_factor. Used for clusters only.

  • sharding (str) – Sharding method used for new collections in this database. Allowed values are: “”, “flexible” and “single”. The first two are equivalent. Used for clusters only.

Returns

True if database was created successfully.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseCreateError – If create fails.

Here is an example entry for parameter users:

{
    'username': 'john',
    'password': 'password',
    'active': True,
    'extra': {'Department': 'IT'}
}
async create_graph(name: str, edge_definitions: Optional[Sequence[Dict[str, Any]]] = None, orphan_collections: Optional[Sequence[str]] = None, smart: Optional[bool] = None, smart_field: Optional[str] = None, shard_count: Optional[int] = None) Optional[Union[python_aioarango.graph.Graph, python_aioarango.job.AsyncJob[python_aioarango.graph.Graph], python_aioarango.job.BatchJob[python_aioarango.graph.Graph]]]

Create a new graph.

Parameters
  • name (str) – Graph name.

  • edge_definitions ([dict] | None) – List of edge definitions, where each edge definition entry is a dictionary with fields “edge_collection”, “from_vertex_collections” and “to_vertex_collections” (see below for example).

  • orphan_collections ([str] | None) – Names of additional vertex collections that are not in edge definitions.

  • smart (bool | None) – If set to True, sharding is enabled (see parameter smart_field below). Applies only to enterprise version of ArangoDB.

  • smart_field (str | None) – Document field used to shard the vertices of the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. Applies only to enterprise version of ArangoDB.

  • shard_count (int | None) – Number of shards used for every collection in the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. This number cannot be modified later once set. Applies only to enterprise version of ArangoDB.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

Raises

python_aioarango.exceptions.GraphCreateError – If create fails.

Here is an example entry for parameter edge_definitions:

{
    'edge_collection': 'teach',
    'from_vertex_collections': ['teachers'],
    'to_vertex_collections': ['lectures']
}
async create_task(name: str, command: str, params: Optional[Dict[str, Any]] = None, period: Optional[int] = None, offset: Optional[int] = None, task_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new server task.

Parameters
  • name (str) – Name of the server task.

  • command (str) – Javascript command to execute.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • period (int | None) – Number of seconds to wait between executions. If set to 0, the new task will be “timed”, meaning it will execute only once and be deleted afterwards.

  • offset (int | None) – Initial delay before execution in seconds.

  • task_id (str | None) – Pre-defined ID for the new server task.

Returns

Details of the new task.

Return type

dict

Raises

python_aioarango.exceptions.TaskCreateError – If create fails.

async create_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new user.

Parameters
  • username (str) – Username.

  • password (str | None) – Password.

  • active (bool | None) – True if user is active, False otherwise.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserCreateError – If create fails.

async create_view(name: str, view_type: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async databases() Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return the names all databases.

Returns

Database names.

Return type

[str]

Raises

python_aioarango.exceptions.DatabaseListError – If retrieval fails.

property db_name: str

Return the name of the current database.

Returns

Database name.

Return type

str

async delete_analyzer(name: str, force: bool = False, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete an analyzer.

Parameters
  • name (str) – Analyzer name.

  • force (bool) – Remove the analyzer configuration even if in use.

  • ignore_missing (bool) – Do not raise an exception on missing analyzer.

Returns

True if analyzer was deleted successfully, False if analyzer was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.AnalyzerDeleteError – If delete fails.

async delete_collection(name: str, ignore_missing: bool = False, system: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the collection.

Parameters
  • name (str) – Collection name.

  • ignore_missing (bool) – Do not raise an exception on missing collection.

  • system (bool) – Whether the collection is a system collection.

Returns

True if collection was deleted successfully, False if collection was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.CollectionDeleteError – If delete fails.

async delete_database(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the database.

Parameters
  • name (str) – Database name.

  • ignore_missing (bool) – Do not raise an exception on missing database.

Returns

True if database was deleted successfully, False if database was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseDeleteError – If delete fails.

async delete_document(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Delete a document.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision), or True if parameter silent was set to True, or False if document was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool | dict

Raises
async delete_graph(name: str, ignore_missing: bool = False, drop_collections: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Drop the graph of the given name from the database.

Parameters
  • name (str) – Graph name.

  • ignore_missing (bool) – Do not raise an exception on missing graph.

  • drop_collections (bool | None) – Drop the collections of the graph also. This is only if they are not in use by other graphs.

Returns

True if graph was deleted successfully, False if graph was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.GraphDeleteError – If delete fails.

async delete_task(task_id: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a server task.

Parameters
  • task_id (str) – Server task ID.

  • ignore_missing (bool) – Do not raise an exception on missing task.

Returns

True if task was successfully deleted, False if task was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.TaskDeleteError – If delete fails.

async delete_user(username: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a user.

Parameters
  • username (str) – Username.

  • ignore_missing (bool) – Do not raise an exception on missing user.

Returns

True if user was deleted successfully, False if user was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.UserDeleteError – If delete fails.

async delete_view(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a view.

Parameters
  • name (str) – View name.

  • ignore_missing (bool) – Do not raise an exception on missing view.

Returns

True if view was deleted successfully, False if view was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.ViewDeleteError – If delete fails.

async details() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server details.

Returns

Server details.

Return type

dict

Raises

python_aioarango.exceptions.ServerDetailsError – If retrieval fails.

async document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]]

Return a document.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

Document, or None if not found.

Return type

dict | None

Raises
async echo() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return details of the last request (e.g. headers, payload).

Returns

Details of the last request.

Return type

dict

Raises

python_aioarango.exceptions.ServerEchoError – If retrieval fails.

async encryption() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Rotate the user-supplied keys for encryption.

This method is available only for enterprise edition of ArangoDB.

Returns

New TLS data.

Return type

dict

Raises

python_aioarango.exceptions.ServerEncryptionError – If retrieval fails.

async engine() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the database engine details.

Returns

Database engine details.

Return type

dict

Raises

python_aioarango.exceptions.ServerEngineError – If retrieval fails.

async execute_transaction(command: str, params: Optional[Dict[str, Any]] = None, read: Optional[Sequence[str]] = None, write: Optional[Sequence[str]] = None, sync: Optional[bool] = None, timeout: Optional[numbers.Number] = None, max_size: Optional[int] = None, allow_implicit: Optional[bool] = None, intermediate_commit_count: Optional[int] = None, intermediate_commit_size: Optional[int] = None) Optional[Union[Any, python_aioarango.job.AsyncJob[Any], python_aioarango.job.BatchJob[Any]]]

Execute raw Javascript command in transaction.

Parameters
  • command (str) – Javascript command to execute.

  • read ([str] | None) – Names of collections read during transaction. If parameter allow_implicit is set to True, any undeclared read collections are loaded lazily.

  • write ([str] | None) – Names of collections written to during transaction. Transaction fails on undeclared write collections.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • timeout (int | None) – Timeout for waiting on collection locks. If set to 0, ArangoDB server waits indefinitely. If not set, system default value is used.

  • max_size (int | None) – Max transaction size limit in bytes.

  • allow_implicit (bool | None) – If set to True, undeclared read collections are loaded lazily. If set to False, transaction fails on any undeclared collections.

  • intermediate_commit_count (int | None) – Max number of operations after which an intermediate commit is performed automatically.

  • intermediate_commit_size (int | None) – Max size of operations in bytes after which an intermediate commit is performed automatically.

Returns

Return value of command.

Return type

Any

Raises

python_aioarango.exceptions.TransactionExecuteError – If execution fails.

property foxx: python_aioarango.foxx.Foxx

Return Foxx API wrapper.

Returns

Foxx API wrapper.

Return type

python_aioarango.foxx.Foxx

graph(name: str) python_aioarango.graph.Graph

Return the graph API wrapper.

Parameters

name (str) – Graph name.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

async graphs() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

List all graphs in the database.

Returns

Graphs in the database.

Return type

[dict]

Raises

python_aioarango.exceptions.GraphListError – If retrieval fails.

async has_collection(name)

Check if collection exists in the database.

Parameters

name (str) – Collection name.

Returns

True if collection exists, False otherwise.

Return type

bool

async has_database(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a database exists.

Parameters

name (str) – Database name.

Returns

True if database exists, False otherwise.

Return type

bool

async has_document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a document exists.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

True if document exists, False otherwise.

Return type

bool

Raises
async has_graph(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a graph exists in the database.

Parameters

name (str | unicode) – Graph name.

Returns

True if graph exists, False otherwise.

Return type

bool

async has_user(username: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if user exists.

Parameters

username (str) – Username.

Returns

True if user exists, False otherwise.

Return type

bool

async insert_document(collection: str, document: Dict[str, Any], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False, overwrite_mode: Optional[str] = None, keep_none: Optional[bool] = None, merge: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Insert a new document.

Parameters
  • collection (str) – Collection name.

  • document (dict) – Document to insert. If it contains the “_key” or “_id” field, the value is used as the key of the new document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate key and the existing document is replaced.

  • return_old (bool) – Include body of the old document if replaced. Applies only when value of overwrite is set to True.

  • overwrite_mode (str | None) – Overwrite behavior used when the document key exists already. Allowed values are “replace” (replace-insert) or “update” (update-insert). Implicitly sets the value of parameter overwrite.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely. Applies only when overwrite_mode is set to “update” (update-insert).

  • merge (bool | None) – If set to True (default), sub-dictionaries are merged instead of the new one overwriting the old one. Applies only when overwrite_mode is set to “update” (update-insert).

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return information on currently loaded JWT secrets.

Returns

Information on currently loaded JWT secrets.

Return type

dict

async log_levels() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return current logging levels.

Returns

Current logging levels.

Return type

dict

async metrics() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server metrics in Prometheus format.

Returns

Server metrics in Prometheus format.

Return type

str

property name: str

Return database name.

Returns

Database name.

Return type

str

async permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

Permission for given database or collection.

Return type

str

Raises

python_aioarango.exceptions.PermissionGetError – If retrieval fails.

async permissions(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user permissions for all databases and collections.

Parameters

username (str) – Username.

Returns

User permissions for all databases and collections.

Return type

dict

Raises

python_aioarango.exceptions.PermissionListError – If retrieval fails.

property pregel: python_aioarango.pregel.Pregel

Return Pregel API wrapper.

Returns

Pregel API wrapper.

Return type

python_aioarango.pregel.Pregel

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return database properties.

Returns

Database properties.

Return type

dict

Raises

python_aioarango.exceptions.DatabasePropertiesError – If retrieval fails.

async read_log(upto: Optional[Union[int, str]] = None, level: Optional[Union[int, str]] = None, start: Optional[int] = None, size: Optional[int] = None, offset: Optional[int] = None, search: Optional[str] = None, sort: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Read the global log from server.

Parameters
  • upto (int | str) – Return the log entries up to the given level (mutually exclusive with parameter level). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • level (int | str) – Return the log entries of only the given level (mutually exclusive with upto). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • start (int) – Return the log entries whose ID is greater or equal to the given value.

  • size (int) – Restrict the size of the result to the given value. This can be used for pagination.

  • offset (int) – Number of entries to skip (e.g. for pagination).

  • search (str) – Return only the log entries containing the given text.

  • sort (str) – Sort the log entries according to the given fashion, which can be “sort” or “desc”.

Returns

Server log entries.

Return type

dict

Raises

python_aioarango.exceptions.ServerReadLogError – If read fails.

async reload_jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Hot-reload JWT secrets.

Calling this without payload reloads JWT secrets from disk. Only files specified via arangod startup option --server.jwt-secret-keyfile or --server.jwt-secret-folder are used. It is not possible to change the location where files are loaded from without restarting the server.

Returns

Information on reloaded JWT secrets.

Return type

dict

async reload_routing() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reload the routing information.

Returns

True if routing was reloaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerReloadRoutingError – If reload fails.

async reload_tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Reload TLS data (server key, client-auth CA).

Returns

New TLS data.

Return type

dict

async rename_view(name: str, new_name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Rename a view.

Parameters
  • name (str) – View name.

  • new_name (str) – New view name.

Returns

True if view was renamed successfully.

Return type

bool

Raises

python_aioarango.exceptions.ViewRenameError – If delete fails.

async replace_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

async replace_document(document: Dict[str, Any], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Replace a document.

Parameters
  • document (dict) – New document to replace the old one with. It must contain the “_id” field. Edge document must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace_user(username: str, password: str, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a user.

Parameters
  • username (str) – Username.

  • password (str) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserReplaceError – If replace fails.

async replace_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

property replication: python_aioarango.replication.Replication

Return Replication API wrapper.

Returns

Replication API wrapper.

Return type

python_aioarango.replication.Replication

async required_db_version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return required version of target database.

Returns

Required version of target database.

Return type

str

Raises

python_aioarango.exceptions.ServerRequiredDBVersionError – If retrieval fails.

async reset_permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reset user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str) – Collection name.

Returns

True if permission was reset successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionRestError – If reset fails.

async role() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server role.

Returns

Server role. Possible values are “SINGLE” (server which is not in a cluster), “COORDINATOR” (cluster coordinator), “PRIMARY”, “SECONDARY”, “AGENT” (Agency node in a cluster) or “UNDEFINED”.

Return type

str

Raises

python_aioarango.exceptions.ServerRoleError – If retrieval fails.

async run_tests(tests: Sequence[str]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Run available unittests on the server.

Parameters

tests ([str]) – List of files containing the test suites.

Returns

Test results.

Return type

dict

Raises

python_aioarango.exceptions.ServerRunTestsError – If execution fails.

async set_log_levels(**kwargs: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Set the logging levels.

This method takes arbitrary keyword arguments where the keys are the logger names and the values are the logging levels. For example:

python_aioarango.set_log_levels(
    agency='DEBUG',
    collector='INFO',
    threads='WARNING'
)

Keys that are not valid logger names are ignored.

Returns

New logging levels.

Return type

dict

async shutdown() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Initiate server shutdown sequence.

Returns

True if the server was shutdown successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerShutdownError – If shutdown fails.

async statistics(description: bool = False) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return server statistics.

Returns

Server statistics.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatisticsError – If retrieval fails.

async status() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server status.

Returns

Server status.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatusError – If retrieval fails.

async task(task_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the details of an active server task.

Parameters

task_id (str) – Server task ID.

Returns

Server task details.

Return type

dict

Raises

python_aioarango.exceptions.TaskGetError – If retrieval fails.

async tasks() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all currently active server tasks.

Returns

Currently active server tasks.

Return type

[dict]

Raises

python_aioarango.exceptions.TaskListError – If retrieval fails.

async time() Optional[Union[datetime.datetime, python_aioarango.job.AsyncJob[datetime.datetime], python_aioarango.job.BatchJob[datetime.datetime]]]

Return server system time.

Returns

Server system time.

Return type

datetime.datetime

Raises

python_aioarango.exceptions.ServerTimeError – If retrieval fails.

async tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return TLS data (server key, client-auth CA).

Returns

TLS data.

Return type

dict

async update_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async update_document(document: Dict[str, Any], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Update a document.

Parameters
  • document (dict) – Partial or full document with the updated values. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new one overwriting the old one.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async update_permission(username: str, permission: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Update user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • permission (str) – Allowed values are “rw” (read and write), “ro” (read only) or “none” (no access).

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

True if access was granted successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionUpdateError – If update fails.

async update_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a user.

Parameters
  • username (str) – Username.

  • password (str | None) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserUpdateError – If update fails.

async update_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async user(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user details.

Parameters

username (str) – Username.

Returns

User details.

Return type

dict

Raises

python_aioarango.exceptions.UserGetError – If retrieval fails.

property username: Optional[str]

Return the username.

Returns

Username.

Return type

str

async users() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all user details.

Returns

List of user details.

Return type

[dict]

Raises

python_aioarango.exceptions.UserListError – If retrieval fails.

async version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return ArangoDB server version.

Returns

Server version.

Return type

str

Raises

python_aioarango.exceptions.ServerVersionError – If retrieval fails.

async view(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return view details.

Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewGetError – If retrieval fails.

async views() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of views and their summaries.

Returns

List of views.

Return type

[dict]

Raises

python_aioarango.exceptions.ViewListError – If retrieval fails.

property wal: python_aioarango.wal.WAL

Return WAL (Write-Ahead Log) API wrapper.

Returns

WAL API wrapper.

Return type

python_aioarango.wal.WAL

BatchJob

class python_aioarango.job.BatchJob(response_handler: Callable[[python_aioarango.response.Response], python_aioarango.job.T])[source]

Job for tracking and retrieving result of batch API execution.

Parameters

response_handler (callable) – HTTP response handler.

property id: str

Return the batch job ID.

Returns

Batch job ID.

Return type

str

status() str[source]

Return the batch job status.

Returns

Batch job status. Possible values are “pending” (job is still waiting for batch to be committed), or “done” (batch was committed and the job is updated with the result).

Return type

str

result() python_aioarango.job.T[source]

Return the batch job result.

If the job raised an exception, it is propagated up at this point.

Returns

Batch job result.

Raises

Cluster

class python_aioarango.cluster.Cluster(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]
async server_id() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return the server ID.

Returns

Server ID.

Return type

str

Raises

python_aioarango.exceptions.ClusterServerIDError – If retrieval fails.

async server_role() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return the server role.

Returns

Server role. Possible values are “SINGLE” (server which is not in a cluster), “COORDINATOR” (cluster coordinator), “PRIMARY”, “SECONDARY”, “AGENT” (Agency server in a cluster) or “UNDEFINED”.

Return type

str

Raises

python_aioarango.exceptions.ClusterServerRoleError – If retrieval fails.

async server_version(server_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the version of the given server.

Parameters

server_id (str) – Server ID.

Returns

Version of the given server.

Return type

dict

Raises

python_aioarango.exceptions.ClusterServerVersionError – If retrieval fails.

async server_engine(server_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the engine details for the given server.

Parameters

server_id (str) – Server ID.

Returns

Engine details of the given server.

Return type

dict

Raises

python_aioarango.exceptions.ClusterServerEngineError – If retrieval fails.

async server_count() Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]][source]

Return the number of servers in the cluster.

Returns

Number of servers in the cluster.

Return type

int

Raises

python_aioarango.exceptions.ClusterServerCountError – If retrieval fails.

async server_statistics(server_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the statistics for the given server.

Parameters

server_id (str) – Server ID.

Returns

Statistics for the given server.

Return type

dict

Raises

python_aioarango.exceptions.ClusterServerStatisticsError – If retrieval fails.

async health() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the cluster health.

Returns

Cluster health.

Return type

dict

Raises

python_aioarango.exceptions.ClusterHealthError – If retrieval fails.

async toggle_maintenance_mode(mode: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Enable or disable the cluster supervision (agency) maintenance mode.

Parameters

mode (str) – Maintenance mode. Allowed values are “on” and “off”.

Returns

Result of the operation.

Return type

dict

Raises

python_aioarango.exceptions.ClusterMaintenanceModeError – If toggle fails.

async endpoints() Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]][source]

Return coordinate endpoints. This method is for clusters only.

Returns

List of endpoints.

Return type

[str]

Raises

python_aioarango.exceptions.ServerEndpointsError – If retrieval fails.

Collection

class python_aioarango.collection.Collection(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor], name: str)[source]

Base class for collection API wrappers.

Parameters
  • connection – HTTP connection.

  • executor – API executor.

  • name – Collection name.

property name: str

Return collection name.

Returns

Collection name.

Return type

str

async recalculate_count() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Recalculate the document count.

Returns

True if recalculation was successful.

Return type

bool

Raises

python_aioarango.exceptions.CollectionRecalculateCountError – If operation fails.

async responsible_shard(document: Dict[str, Any]) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return the ID of the shard responsible for given document.

If the document does not exist, return the shard that would be responsible.

Returns

Shard ID

Return type

str

async rename(new_name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Rename the collection.

Renames may not be reflected immediately in async execution, batch execution or transactions. It is recommended to initialize new API wrappers after a rename.

Parameters

new_name (str) – New collection name.

Returns

True if collection was renamed successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionRenameError – If rename fails.

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return collection properties.

Returns

Collection properties.

Return type

dict

Raises

python_aioarango.exceptions.CollectionPropertiesError – If retrieval fails.

async configure(sync: Optional[bool] = None, schema: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Configure collection properties.

Parameters
  • sync (bool | None) – Block until operations are synchronized to disk.

  • schema (dict) – document schema for validation of objects.

Returns

New collection properties.

Return type

dict

Raises

python_aioarango.exceptions.CollectionConfigureError – If operation fails.

async statistics() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return collection statistics.

Returns

Collection statistics.

Return type

dict

Raises

python_aioarango.exceptions.CollectionStatisticsError – If retrieval fails.

async revision() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return collection revision.

Returns

Collection revision.

Return type

str

Raises

python_aioarango.exceptions.CollectionRevisionError – If retrieval fails.

async checksum(with_rev: bool = False, with_data: bool = False) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return collection checksum.

Parameters
  • with_rev (bool) – Include document revisions in checksum calculation.

  • with_data (bool) – Include document data in checksum calculation.

Returns

Collection checksum.

Return type

str

Raises

python_aioarango.exceptions.CollectionChecksumError – If retrieval fails.

async load() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Load the collection into memory.

Returns

True if collection was loaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionLoadError – If operation fails.

async unload() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Unload the collection from memory.

Returns

True if collection was unloaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionUnloadError – If operation fails.

async truncate() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Delete all documents in the collection.

Returns

True if collection was truncated successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionTruncateError – If operation fails.

async count() Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]][source]

Return the total document count.

Returns

Total document count.

Return type

int

Raises

python_aioarango.exceptions.DocumentCountError – If retrieval fails.

async has(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Check if a document exists in the collection.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

True if document exists, False otherwise.

Return type

bool

Raises
async ids() Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return the IDs of all documents in the collection.

Returns

Document ID cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentIDsError – If retrieval fails.

async keys() Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return the keys of all documents in the collection.

Returns

Document key cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentKeysError – If retrieval fails.

async all(skip: Optional[int] = None, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return all documents in the collection.

Parameters
  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async export(limit: Optional[int] = None, count: bool = False, batch_size: Optional[int] = None, flush: bool = False, flush_wait: Optional[int] = None, ttl: Optional[numbers.Number] = None, filter_fields: Optional[Sequence[str]] = None, filter_type: str = 'include') Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Export all documents in the collection using a server cursor.

Parameters
  • flush (bool) – If set to True, flush the write-ahead log prior to the export. If set to False, documents in the write-ahead log during the export are not included in the result.

  • flush_wait (int | None) – Max wait time in seconds for write-ahead log flush.

  • count (bool) – Include the document count in the server cursor.

  • batch_size (int | None) – Max number of documents in the batch fetched by the cursor in one round trip.

  • limit (int | None) – Max number of documents fetched by the cursor.

  • ttl (int | float | None) – Time-to-live for the cursor on the server.

  • filter_fields ([str] | None) – Document fields to filter with.

  • filter_type (str) – Allowed values are “include” or “exclude”.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If export fails.

async find(filters: Dict[str, Any], skip: Optional[int] = None, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return all documents that match the given filters.

Parameters
  • filters (dict) – Document filters.

  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_near(latitude: numbers.Number, longitude: numbers.Number, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return documents near a given coordinate.

Documents returned are sorted according to distance, with the nearest document being the first. If there are documents of equal distance, they are randomly chosen from the set until the limit is reached. A geo index must be defined in the collection to use this method.

Parameters
  • latitude (int | float) – Latitude.

  • longitude (int | float) – Longitude.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_in_range(field: str, lower: int, upper: int, skip: Optional[int] = None, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return documents within a given range in a random order.

A skiplist index must be defined in the collection to use this method.

Parameters
  • field (str) – Document field name.

  • lower (int) – Lower bound (inclusive).

  • upper (int) – Upper bound (exclusive).

  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_in_radius(latitude: numbers.Number, longitude: numbers.Number, radius: numbers.Number, distance_field: Optional[str] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return documents within a given radius around a coordinate.

A geo index must be defined in the collection to use this method.

Parameters
  • latitude (int | float) – Latitude.

  • longitude (int | float) – Longitude.

  • radius (int | float) – Max radius.

  • distance_field (str) – Document field used to indicate the distance to the given coordinate. This parameter is ignored in transactions.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_in_box(latitude1: numbers.Number, longitude1: numbers.Number, latitude2: numbers.Number, longitude2: numbers.Number, skip: Optional[int] = None, limit: Optional[int] = None, index: Optional[str] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return all documents in an rectangular area.

Parameters
  • latitude1 (int | float) – First latitude.

  • longitude1 (int | float) – First longitude.

  • latitude2 (int | float) – Second latitude.

  • longitude2 (int | float) – Second longitude

  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

  • index (str | None) – ID of the geo index to use (without the collection prefix). This parameter is ignored in transactions.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_by_text(field: str, query: str, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]][source]

Return documents that match the given fulltext query.

Parameters
  • field (str) – Document field with fulltext index.

  • query (str) – Fulltext query.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async get_many(documents: Sequence[Union[str, Dict[str, Any]]]) Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

Return multiple documents ignoring any missing ones.

Parameters

documents ([str | dict]) – List of document keys, IDs or bodies. Document bodies must contain the “_id” or “_key” fields.

Returns

Documents. Missing ones are not included.

Return type

[dict]

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async random() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return a random document from the collection.

Returns

A random document.

Return type

dict

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async indexes() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

Return the collection indexes.

Returns

Collection indexes.

Return type

[dict]

Raises

python_aioarango.exceptions.IndexListError – If retrieval fails.

async add_hash_index(fields: Sequence[str], unique: Optional[bool] = None, sparse: Optional[bool] = None, deduplicate: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new hash index.

Parameters
  • fields ([str]) – Document fields to index.

  • unique (bool | None) – Whether the index is unique.

  • sparse (bool | None) – If set to True, documents with None in the field are also indexed. If set to False, they are skipped.

  • deduplicate (bool | None) – If set to True, inserting duplicate index values from the same document triggers unique constraint errors.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_skiplist_index(fields: Sequence[str], unique: Optional[bool] = None, sparse: Optional[bool] = None, deduplicate: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new skiplist index.

Parameters
  • fields ([str]) – Document fields to index.

  • unique (bool | None) – Whether the index is unique.

  • sparse (bool | None) – If set to True, documents with None in the field are also indexed. If set to False, they are skipped.

  • deduplicate (bool | None) – If set to True, inserting duplicate index values from the same document triggers unique constraint errors.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_geo_index(fields: Union[str, Sequence[str]], ordered: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new geo-spatial index.

Parameters
  • fields (str | [str]) – A single document field or a list of document fields. If a single field is given, the field must have values that are lists with at least two floats. Documents with missing fields or invalid values are excluded.

  • ordered (bool | None) – Whether the order is longitude, then latitude.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_fulltext_index(fields: Sequence[str], min_length: Optional[int] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new fulltext index.

Parameters
  • fields ([str]) – Document fields to index.

  • min_length (int | None) – Minimum number of characters to index.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_persistent_index(fields: Sequence[str], unique: Optional[bool] = None, sparse: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new persistent index.

Unique persistent indexes on non-sharded keys are not supported in a cluster.

Parameters
  • fields ([str]) – Document fields to index.

  • unique (bool | None) – Whether the index is unique.

  • sparse (bool | None) – Exclude documents that do not contain at least one of the indexed fields, or documents that have a value of None in any of the indexed fields.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_ttl_index(fields: Sequence[str], expiry_time: int, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new TTL (time-to-live) index.

Parameters
  • fields ([str]) – Document field to index.

  • expiry_time (int) – Time of expiry in seconds after document creation.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async delete_index(index_id: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Delete an index.

Parameters
  • index_id (str) – Index ID.

  • ignore_missing (bool) – Do not raise an exception on missing index.

Returns

True if index was deleted successfully, False if index was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.IndexDeleteError – If delete fails.

async load_indexes() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Cache all indexes in the collection into memory.

Returns

True if index was loaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.IndexLoadError – If operation fails.

async insert_many(documents: Sequence[Dict[str, Any]], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]][source]

Insert multiple documents.

Note

If inserting a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were inserted successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single insert operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – List of new documents to insert. If they contain the “_key” or “_id” fields, the values are used as the keys of the new documents (auto-generated otherwise). Any “_rev” field is ignored.

  • return_new (bool) – Include bodies of the new documents in the returned metadata. Ignored if parameter silent is set to True

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate keys and the existing documents are replaced.

  • return_old (bool) – Include body of the old documents if replaced. Applies only when value of overwrite is set to True.

Returns

List of document metadata (e.g. document keys, revisions) and any exception, or True if parameter silent was set to True.

Return type

[dict | ArangoServerError] | bool

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async update_many(documents: Sequence[Dict[str, Any]], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]][source]

Update multiple documents.

Note

If updating a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were updated successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single update operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – Partial or full documents with the updated values. They must contain the “_id” or “_key” fields.

  • check_rev (bool) – If set to True, revisions of documents (if given) are compared against the revisions of target documents.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new ones overwriting the old ones.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

List of document metadata (e.g. document keys, revisions) and any exceptions, or True if parameter silent was set to True.

Return type

[dict | ArangoError] | bool

Raises

python_aioarango.exceptions.DocumentUpdateError – If update fails.

async update_match(filters: Dict[str, Any], body: Dict[str, Any], limit: Optional[int] = None, keep_none: bool = True, sync: Optional[bool] = None, merge: bool = True) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]][source]

Update matching documents.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single update operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • filters (dict) – Document filters.

  • body (dict) – Full or partial document body with the updates.

  • limit (int | None) – Max number of documents to update. If the limit is lower than the number of matched documents, random documents are chosen. This parameter is not supported on sharded collections.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new ones overwriting the old ones.

Returns

Number of documents updated.

Return type

int

Raises

python_aioarango.exceptions.DocumentUpdateError – If update fails.

async replace_many(documents: Sequence[Dict[str, Any]], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]][source]

Replace multiple documents.

Note

If replacing a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were replaced successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single replace operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – New documents to replace the old ones with. They must contain the “_id” or “_key” fields. Edge documents must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revisions of documents (if given) are compared against the revisions of target documents.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

List of document metadata (e.g. document keys, revisions) and any exceptions, or True if parameter silent was set to True.

Return type

[dict | ArangoServerError] | bool

Raises

python_aioarango.exceptions.DocumentReplaceError – If replace fails.

async replace_match(filters: Dict[str, Any], body: Dict[str, Any], limit: Optional[int] = None, sync: Optional[bool] = None) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]][source]

Replace matching documents.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single replace operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • filters (dict) – Document filters.

  • body (dict) – New document body.

  • limit (int | None) – Max number of documents to replace. If the limit is lower than the number of matched documents, random documents are chosen.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

Number of documents replaced.

Return type

int

Raises

python_aioarango.exceptions.DocumentReplaceError – If replace fails.

async delete_many(documents: Sequence[Dict[str, Any]], return_old: bool = False, check_rev: bool = True, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]][source]

Delete multiple documents.

Note

If deleting a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were deleted successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single delete operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([str | dict]) – Document IDs, keys or bodies. Document bodies must contain the “_id” or “_key” fields.

  • return_old (bool) – Include bodies of the old documents in the result.

  • check_rev (bool) – If set to True, revisions of documents (if given) are compared against the revisions of target documents.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

List of document metadata (e.g. document keys, revisions) and any exceptions, or True if parameter silent was set to True.

Return type

[dict | ArangoServerError] | bool

Raises

python_aioarango.exceptions.DocumentDeleteError – If delete fails.

async delete_match(filters: Dict[str, Any], limit: Optional[int] = None, sync: Optional[bool] = None) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]][source]

Delete matching documents.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single delete operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • filters (dict) – Document filters.

  • limit (int | None) – Max number of documents to delete. If the limit is lower than the number of matched documents, random documents are chosen.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

Number of documents deleted.

Return type

int

Raises

python_aioarango.exceptions.DocumentDeleteError – If delete fails.

async import_bulk(documents: Sequence[Dict[str, Any]], halt_on_error: bool = True, details: bool = True, from_prefix: Optional[str] = None, to_prefix: Optional[str] = None, overwrite: Optional[bool] = None, on_duplicate: Optional[str] = None, sync: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Insert multiple documents into the collection.

Note

This method is faster than python_aioarango.collection.Collection.insert_many() but does not return as many details.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single insert operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – List of new documents to insert. If they contain the “_key” or “_id” fields, the values are used as the keys of the new documents (auto-generated otherwise). Any “_rev” field is ignored.

  • halt_on_error (bool) – Halt the entire import on an error.

  • details (bool) – If set to True, the returned result will include an additional list of detailed error messages.

  • from_prefix (str) – String prefix prepended to the value of “_from” field in each edge document inserted. For example, prefix “foo” prepended to “_from”: “bar” will result in “_from”: “foo/bar”. Applies only to edge collections.

  • to_prefix (str) – String prefix prepended to the value of “_to” field in edge document inserted. For example, prefix “foo” prepended to “_to”: “bar” will result in “_to”: “foo/bar”. Applies only to edge collections.

  • overwrite (bool) – If set to True, all existing documents are removed prior to the import. Indexes are still preserved.

  • on_duplicate (str) – Action to take on unique key constraint violations (for documents with “_key” fields). Allowed values are “error” (do not import the new documents and count them as errors), “update” (update the existing documents while preserving any fields missing in the new ones), “replace” (replace the existing documents with new ones), and “ignore” (do not import the new documents and count them as ignored, as opposed to counting them as errors). Options “update” and “replace” may fail on secondary unique key constraint violations.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

Result of the bulk import.

Return type

dict

Raises

python_aioarango.exceptions.DocumentInsertError – If import fails.

Cursor

class python_aioarango.cursor.Cursor(connection: python_aioarango.connection.BaseConnection, init_data: Dict[str, Any], cursor_type: str = 'cursor')[source]

Cursor API wrapper.

Cursors fetch query results from ArangoDB server in batches. Cursor objects are stateful as they store the fetched items in-memory. They must not be shared across threads without proper locking mechanism.

Parameters
  • connection – HTTP connection.

  • init_data (dict) – Cursor initialization data.

  • cursor_type (str) – Cursor type (“cursor” or “export”).

property id: Optional[str]

Return the cursor ID.

Returns

Cursor ID.

Return type

str

property type: str

Return the cursor type.

Returns

Cursor type (“cursor” or “export”).

Return type

str

batch() Optional[Deque[Any]][source]

Return the current batch of results.

Returns

Current batch.

Return type

collections.deque

has_more() Optional[bool][source]

Return True if more results are available on the server.

Returns

True if more results are available on the server.

Return type

bool

count() Optional[int][source]

Return the total number of documents in the entire result set.

Returns

Total number of documents, or None if the count option was not enabled during cursor initialization.

Return type

int | None

cached() Optional[bool][source]

Return True if results are cached.

Returns

True if results are cached.

Return type

bool

statistics() Optional[Dict[str, Any]][source]

Return cursor statistics.

Returns

Cursor statistics.

Return type

dict

profile() Optional[Dict[str, Any]][source]

Return cursor performance profile.

Returns

Cursor performance profile.

Return type

dict

warnings() Optional[Sequence[Dict[str, Any]]][source]

Return any warnings from the query execution.

Returns

Warnings, or None if there are none.

Return type

[str]

empty() bool[source]

Check if the current batch is empty.

Returns

True if current batch is empty, False otherwise.

Return type

bool

async next() Any[source]

Pop the next item from the current batch.

If current batch is empty/depleted, an API request is automatically sent to ArangoDB server to fetch the next batch and update the cursor.

Returns

Next item in current batch.

Raises
pop() Any[source]

Pop the next item from current batch.

If current batch is empty/depleted, an exception is raised. You must call python_aioarango.cursor.Cursor.fetch() to manually fetch the next batch from server.

Returns

Next item in current batch.

Raises

python_aioarango.exceptions.CursorEmptyError – If current batch is empty.

async fetch() Dict[str, Any][source]

Fetch the next batch from server and update the cursor.

Returns

New batch details.

Return type

dict

Raises
async close(ignore_missing: bool = False) Optional[bool][source]

Close the cursor and free any server resources tied to it.

Parameters

ignore_missing (bool) – Do not raise exception on missing cursors.

Returns

True if cursor was closed successfully, False if cursor was missing on the server and ignore_missing was set to True, None if there are no cursors to close server-side (e.g. result set is smaller than the batch size).

Return type

bool | None

Raises

DefaultHTTPClient

class python_aioarango.http.DefaultHTTPClient[source]

Default HTTP client implementation.

create_session(host: str) httpx.AsyncClient[source]

Create and return a new session/connection.

Parameters

host (str | unicode) – ArangoDB host URL.

Returns

httpx client object

Return type

httpx.AsyncClient

async send_request(session: httpx.AsyncClient, method: str, url: str, headers: Optional[MutableMapping[str, str]] = None, params: Optional[MutableMapping[str, str]] = None, data: Optional[str] = None, auth: Optional[Tuple[str, str]] = None) python_aioarango.response.Response[source]

Send an HTTP request.

Parameters
  • session (httpx.AsyncClient) – httpx client object.

  • method (str) – HTTP method in lowercase (e.g. “post”).

  • url (str) – Request URL.

  • headers (dict) – Request headers.

  • params (dict) – URL (query) parameters.

  • data (str | None) – Request payload.

  • auth (tuple) – Username and password.

Returns

HTTP response.

Return type

python_aioarango.response.Response

EdgeCollection

class python_aioarango.collection.EdgeCollection(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor], graph: str, name: str)[source]

ArangoDB edge collection API wrapper.

Parameters
  • connection – HTTP connection.

  • executor – API executor.

  • graph – Graph name.

  • name – Edge collection name.

property graph: str

Return the graph name.

Returns

Graph name.

Return type

str

async get(edge: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]][source]

Return an edge document.

Parameters
  • edge (str | dict) – Edge document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in edge if present.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

Returns

Edge document or None if not found.

Return type

dict | None

Raises
async insert(edge: Dict[str, Any], sync: Optional[bool] = None, silent: bool = False, return_new: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Insert a new edge document.

Parameters
  • edge (dict) – New edge document to insert. It must contain “_from” and “_to” fields. If it has “_key” or “_id” field, its value is used as key of the new edge document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async update(edge: Dict[str, Any], check_rev: bool = True, keep_none: bool = True, sync: Optional[bool] = None, silent: bool = False, return_old: bool = False, return_new: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Update an edge document.

Parameters
  • edge (dict) – Partial or full edge document with updated values. It must contain the “_key” or “_id” field.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. If set to False, they are removed completely.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace(edge: Dict[str, Any], check_rev: bool = True, sync: Optional[bool] = None, silent: bool = False, return_old: bool = False, return_new: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Replace an edge document.

Parameters
  • edge (dict) – New edge document to replace the old one with. It must contain the “_key” or “_id” field. It must also contain the “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async delete(edge: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, sync: Optional[bool] = None, return_old: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Delete an edge document.

Parameters
  • edge (str | dict) – Edge document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in edge if present.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • return_old (bool) – Return body of the old document in the result.

Returns

True if edge was deleted successfully, False if edge was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool

Raises

Insert a new edge document linking the given vertices.

Parameters
  • from_vertex (str | dict) – “From” vertex document ID or body with “_id” field.

  • to_vertex (str | dict) – “To” vertex document ID or body with “_id” field.

  • data (dict | None) – Any extra data for the new edge document. If it has “_key” or “_id” field, its value is used as key of the new edge document (otherwise it is auto-generated).

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async edges(vertex: Union[str, Dict[str, Any]], direction: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the edge documents coming in and/or out of the vertex.

Parameters
  • vertex (str | dict) – Vertex document ID or body with “_id” field.

  • direction (str) – The direction of the edges. Allowed values are “in” and “out”. If not set, edges in both directions are returned.

Returns

List of edges and statistics.

Return type

dict

Raises

python_aioarango.exceptions.EdgeListError – If retrieval fails.

Foxx

class python_aioarango.foxx.Foxx(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]

Foxx API wrapper.

async services(exclude_system: bool = False) Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

List installed services.

Parameters

exclude_system (bool) – If set to True, system services are excluded.

Returns

List of installed service.

Return type

[dict]

Raises

python_aioarango.exceptions.FoxxServiceListError – If retrieval fails.

async service(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return service metadata.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceGetError – If retrieval fails.

async create_service(mount: str, source: str, config: Optional[Dict[str, Any]] = None, dependencies: Optional[Dict[str, Any]] = None, development: Optional[bool] = None, setup: Optional[bool] = None, legacy: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Install a new service using JSON definition.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • source (str) – Fully qualified URL or absolute path on the server file system. Must be accessible by the server, or by all servers if in a cluster.

  • config (dict | None) – Configuration values.

  • dependencies (dict | None) – Dependency settings.

  • development (bool | None) – Enable development mode.

  • setup (bool | None) – Run service setup script.

  • legacy (bool | None) – Install the service in 2.8 legacy compatibility mode.

Returns

Service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceCreateError – If install fails.

async create_service_with_file(mount: str, filename: str, development: Optional[bool] = None, setup: Optional[bool] = None, legacy: Optional[bool] = None, config: Optional[Dict[str, Any]] = None, dependencies: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Install a new service using a javascript file or zip bundle.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • filename (str) – Full path to the javascript file or zip bundle.

  • development (bool | None) – Enable development mode.

  • setup (bool | None) – Run service setup script.

  • legacy (bool | None) – Install the service in 2.8 legacy compatibility mode.

  • config (dict | None) – Configuration values.

  • dependencies (dict | None) – Dependency settings.

Returns

Service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceCreateError – If install fails.

async update_service(mount: str, source: str, config: Optional[Dict[str, Any]] = None, dependencies: Optional[Dict[str, Any]] = None, teardown: Optional[bool] = None, setup: Optional[bool] = None, legacy: Optional[bool] = None, force: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Update (upgrade) a service.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • source (str) – Fully qualified URL or absolute path on the server file system. Must be accessible by the server, or by all servers if in a cluster.

  • config (dict | None) – Configuration values.

  • dependencies (dict | None) – Dependency settings.

  • teardown (bool | None) – Run service teardown script.

  • setup (bool | None) – Run service setup script.

  • legacy (bool | None) – Update the service in 2.8 legacy compatibility mode.

  • force (bool | None) – Force update if no service is found.

Returns

Updated service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceUpdateError – If update fails.

async update_service_with_file(mount: str, filename: str, teardown: Optional[bool] = None, setup: Optional[bool] = None, legacy: Optional[bool] = None, force: Optional[bool] = None, config: Optional[Dict[str, Any]] = None, dependencies: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Update (upgrade) a service using a javascript file or zip bundle.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • filename (str) – Full path to the javascript file or zip bundle.

  • teardown (bool | None) – Run service teardown script.

  • setup (bool | None) – Run service setup script.

  • legacy (bool | None) – Update the service in 2.8 legacy compatibility mode.

  • force (bool | None) – Force update if no service is found.

  • config (dict | None) – Configuration values.

  • dependencies (dict | None) – Dependency settings.

Returns

Updated service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceUpdateError – If update fails.

async replace_service(mount: str, source: str, config: Optional[Dict[str, Any]] = None, dependencies: Optional[Dict[str, Any]] = None, teardown: Optional[bool] = None, setup: Optional[bool] = None, legacy: Optional[bool] = None, force: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Replace a service by removing the old one and installing a new one.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • source (str) – Fully qualified URL or absolute path on the server file system. Must be accessible by the server, or by all servers if in a cluster.

  • config (dict | None) – Configuration values.

  • dependencies (dict | None) – Dependency settings.

  • teardown (bool | None) – Run service teardown script.

  • setup (bool | None) – Run service setup script.

  • legacy (bool | None) – Replace the service in 2.8 legacy compatibility mode.

  • force (bool | None) – Force install if no service is found.

Returns

Replaced service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceReplaceError – If replace fails.

async replace_service_with_file(mount: str, filename: str, teardown: Optional[bool] = None, setup: Optional[bool] = None, legacy: Optional[bool] = None, force: Optional[bool] = None, config: Optional[Dict[str, Any]] = None, dependencies: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Replace a service using a javascript file or zip bundle.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • filename (str) – Full path to the javascript file or zip bundle.

  • teardown (bool | None) – Run service teardown script.

  • setup (bool | None) – Run service setup script.

  • legacy (bool | None) – Replace the service in 2.8 legacy compatibility mode.

  • force (bool | None) – Force install if no service is found.

  • config (dict | None) – Configuration values.

  • dependencies (dict | None) – Dependency settings.

Returns

Replaced service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxServiceReplaceError – If replace fails.

async delete_service(mount: str, teardown: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Uninstall a service.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • teardown (bool | None) – Run service teardown script.

Returns

True if service was deleted successfully.

Return type

bool

Raises

python_aioarango.exceptions.FoxxServiceDeleteError – If delete fails.

async config(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return service configuration.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Configuration values.

Return type

dict

Raises

python_aioarango.exceptions.FoxxConfigGetError – If retrieval fails.

async update_config(mount: str, config: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Update service configuration.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • config (dict) – Configuration values. Omitted options are ignored.

Returns

Updated configuration values.

Return type

dict

Raises

python_aioarango.exceptions.FoxxConfigUpdateError – If update fails.

async replace_config(mount: str, config: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Replace service configuration.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • config (dict) – Configuration values. Omitted options are reset to their default values or marked as un-configured.

Returns

Replaced configuration values.

Return type

dict

Raises

python_aioarango.exceptions.FoxxConfigReplaceError – If replace fails.

async dependencies(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return service dependencies.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Dependency settings.

Return type

dict

Raises

python_aioarango.exceptions.FoxxDependencyGetError – If retrieval fails.

async update_dependencies(mount: str, dependencies: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Update service dependencies.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • dependencies (dict) – Dependencies settings. Omitted ones are ignored.

Returns

Updated dependency settings.

Return type

dict

Raises

python_aioarango.exceptions.FoxxDependencyUpdateError – If update fails.

async replace_dependencies(mount: str, dependencies: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Replace service dependencies.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • dependencies (dict) – Dependencies settings. Omitted ones are disabled.

Returns

Replaced dependency settings.

Return type

dict

Raises

python_aioarango.exceptions.FoxxDependencyReplaceError – If replace fails.

async enable_development(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Put the service into development mode.

While the service is running in development mode, it is reloaded from the file system, and its setup script (if any) is re-executed every time the service handles a request.

In a cluster with multiple coordinators, changes to the filesystem on one coordinator is not reflected across other coordinators.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxDevModeEnableError – If operation fails.

async disable_development(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Put the service into production mode.

In a cluster with multiple coordinators, the services on all other coordinators are replaced with the version on the calling coordinator.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Service metadata.

Return type

dict

Raises

python_aioarango.exceptions.FoxxDevModeDisableError – If operation fails.

async readme(mount: str) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return the service readme.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Service readme.

Return type

str

Raises

python_aioarango.exceptions.FoxxReadmeGetError – If retrieval fails.

async swagger(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the Swagger API description for the given service.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Swagger API description.

Return type

dict

Raises

python_aioarango.exceptions.FoxxSwaggerGetError – If retrieval fails.

async download(mount: str) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Download service bundle.

When development mode is enabled, a new bundle is created every time. Otherwise, the bundle represents the version of the service installed on the server.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Service bundle in raw string form.

Return type

str

Raises

python_aioarango.exceptions.FoxxDownloadError – If download fails.

async commit(replace: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Commit local service state of the coordinator to the database.

This can be used to resolve service conflicts between coordinators that cannot be fixed automatically due to missing data.

Parameters

replace (bool | None) – Overwrite any existing service files in database.

Returns

True if the state was committed successfully.

Return type

bool

Raises

python_aioarango.exceptions.FoxxCommitError – If commit fails.

async scripts(mount: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

List service scripts.

Parameters

mount (str) – Service mount path (e.g “/_admin/aardvark”).

Returns

Service scripts.

Return type

dict

Raises

python_aioarango.exceptions.FoxxScriptListError – If retrieval fails.

async run_script(mount: str, name: str, arg: Optional[Any] = None) Optional[Union[Any, python_aioarango.job.AsyncJob[Any], python_aioarango.job.BatchJob[Any]]][source]

Run a service script.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • name (str) – Script name.

  • arg (Any) – Arbitrary value passed into the script as first argument.

Returns

Result of the script, if any.

Return type

Any

Raises

python_aioarango.exceptions.FoxxScriptRunError – If script fails.

async run_tests(mount: str, reporter: str = 'default', idiomatic: Optional[bool] = None, output_format: Optional[str] = None, name_filter: Optional[str] = None) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Run service tests.

Parameters
  • mount (str) – Service mount path (e.g “/_admin/aardvark”).

  • reporter (str) – Test reporter. Allowed values are “default” (simple list of test cases), “suite” (object of test cases nested in suites), “stream” (raw stream of test results), “xunit” (XUnit or JUnit compatible structure), or “tap” (raw TAP compatible stream).

  • idiomatic – Use matching format for the reporter, regardless of the value of parameter output_format.

  • output_format (str) – Used to further control format. Allowed values are “x-ldjson”, “xml” and “text”. When using “stream” reporter, setting this to “x-ldjson” returns newline-delimited JSON stream. When using “tap” reporter, setting this to “text” returns plain text TAP report. When using “xunit” reporter, settings this to “xml” returns an XML instead of JSONML.

  • name_filter (str) – Only run tests whose full name (test suite and test case) matches the given string.

Type

bool

Returns

Reporter output (e.g. raw JSON string, XML, plain text).

Return type

str

Raises

python_aioarango.exceptions.FoxxTestRunError – If test fails.

Graph

class python_aioarango.graph.Graph(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor], name: str)[source]

Graph API wrapper.

property name: str

Return the graph name.

Returns

Graph name.

Return type

str

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return graph properties.

Returns

Graph properties.

Return type

dict

Raises

python_aioarango.exceptions.GraphPropertiesError – If retrieval fails.

async has_vertex_collection(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Check if the graph has the given vertex collection.

Parameters

name (str) – Vertex collection name.

Returns

True if vertex collection exists, False otherwise.

Return type

bool

async vertex_collections() Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]][source]

Return vertex collections in the graph that are not orphaned.

Returns

Names of vertex collections that are not orphaned.

Return type

[str]

Raises

python_aioarango.exceptions.VertexCollectionListError – If retrieval fails.

vertex_collection(name: str) python_aioarango.collection.VertexCollection[source]

Return the vertex collection API wrapper.

Parameters

name (str) – Vertex collection name.

Returns

Vertex collection API wrapper.

Return type

python_aioarango.collection.VertexCollection

async create_vertex_collection(name: str) Optional[Union[python_aioarango.collection.VertexCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.VertexCollection], python_aioarango.job.BatchJob[python_aioarango.collection.VertexCollection]]][source]

Create a vertex collection in the graph.

Parameters

name (str) – Vertex collection name.

Returns

Vertex collection API wrapper.

Return type

python_aioarango.collection.VertexCollection

Raises

python_aioarango.exceptions.VertexCollectionCreateError – If create fails.

async delete_vertex_collection(name: str, purge: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Remove a vertex collection from the graph.

Parameters
  • name (str) – Vertex collection name.

  • purge (bool) – If set to True, the vertex collection is not just deleted from the graph but also from the database completely.

Returns

True if vertex collection was deleted successfully.

Return type

bool

Raises

python_aioarango.exceptions.VertexCollectionDeleteError – If delete fails.

async has_edge_definition(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Check if the graph has the given edge definition.

Parameters

name (str) – Edge collection name.

Returns

True if edge definition exists, False otherwise.

Return type

bool

async has_edge_collection(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Check if the graph has the given edge collection.

Parameters

name (str) – Edge collection name.

Returns

True if edge collection exists, False otherwise.

Return type

bool

edge_collection(name: str) python_aioarango.collection.EdgeCollection[source]

Return the edge collection API wrapper.

Parameters

name (str) – Edge collection name.

Returns

Edge collection API wrapper.

Return type

python_aioarango.collection.EdgeCollection

async edge_definitions() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]][source]

Return the edge definitions of the graph.

Returns

Edge definitions of the graph.

Return type

[dict]

Raises

python_aioarango.exceptions.EdgeDefinitionListError – If retrieval fails.

async create_edge_definition(edge_collection: str, from_vertex_collections: Sequence[str], to_vertex_collections: Sequence[str]) Optional[Union[python_aioarango.collection.EdgeCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.EdgeCollection], python_aioarango.job.BatchJob[python_aioarango.collection.EdgeCollection]]][source]

Create a new edge definition.

An edge definition consists of an edge collection, “from” vertex collection(s) and “to” vertex collection(s). Here is an example entry:

{
    'edge_collection': 'edge_collection_name',
    'from_vertex_collections': ['from_vertex_collection_name'],
    'to_vertex_collections': ['to_vertex_collection_name']
}
Parameters
  • edge_collection (str) – Edge collection name.

  • from_vertex_collections ([str]) – Names of “from” vertex collections.

  • to_vertex_collections ([str]) – Names of “to” vertex collections.

Returns

Edge collection API wrapper.

Return type

python_aioarango.collection.EdgeCollection

Raises

python_aioarango.exceptions.EdgeDefinitionCreateError – If create fails.

async replace_edge_definition(edge_collection: str, from_vertex_collections: Sequence[str], to_vertex_collections: Sequence[str]) Optional[Union[python_aioarango.collection.EdgeCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.EdgeCollection], python_aioarango.job.BatchJob[python_aioarango.collection.EdgeCollection]]][source]

Replace an edge definition.

Parameters
  • edge_collection (str) – Edge collection name.

  • from_vertex_collections ([str]) – Names of “from” vertex collections.

  • to_vertex_collections ([str]) – Names of “to” vertex collections.

Returns

Edge collection API wrapper.

Return type

python_aioarango.collection.EdgeCollection

Raises

python_aioarango.exceptions.EdgeDefinitionReplaceError – If replace fails.

async delete_edge_definition(name: str, purge: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Delete an edge definition from the graph.

Parameters
  • name (str) – Edge collection name.

  • purge (bool) – If set to True, the edge definition is not just removed from the graph but the edge collection is also deleted completely from the database.

Returns

True if edge definition was deleted successfully.

Return type

bool

Raises

python_aioarango.exceptions.EdgeDefinitionDeleteError – If delete fails.

async traverse(start_vertex: Union[str, Dict[str, Any]], direction: str = 'outbound', item_order: str = 'forward', strategy: Optional[str] = None, order: Optional[str] = None, edge_uniqueness: Optional[str] = None, vertex_uniqueness: Optional[str] = None, max_iter: Optional[int] = None, min_depth: Optional[int] = None, max_depth: Optional[int] = None, init_func: Optional[str] = None, sort_func: Optional[str] = None, filter_func: Optional[str] = None, visitor_func: Optional[str] = None, expander_func: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Traverse the graph and return the visited vertices and edges.

Parameters
  • start_vertex (str | dict) – Start vertex document ID or body with “_id” field.

  • direction (str) – Traversal direction. Allowed values are “outbound” (default), “inbound” and “any”.

  • item_order (str) – Item iteration order. Allowed values are “forward” (default) and “backward”.

  • strategy (str | None) – Traversal strategy. Allowed values are “depthfirst” and “breadthfirst”.

  • order (str | None) – Traversal order. Allowed values are “preorder”, “postorder”, and “preorder-expander”.

  • edge_uniqueness (str | None) – Uniqueness for visited edges. Allowed values are “global”, “path” or “none”.

  • vertex_uniqueness (str | None) – Uniqueness for visited vertices. Allowed values are “global”, “path” or “none”.

  • max_iter (int | None) – If set, halt the traversal after the given number of iterations. This parameter can be used to prevent endless loops in cyclic graphs.

  • min_depth (int | None) – Minimum depth of the nodes to visit.

  • max_depth (int | None) – Maximum depth of the nodes to visit.

  • init_func (str | None) – Initialization function in Javascript with signature (config, result) -> void. This function is used to initialize values in the result.

  • sort_func (str | None) – Sorting function in Javascript with signature (left, right) -> integer, which returns -1 if left < right, +1 if left > right and 0 if left == right.

  • filter_func (str | None) – Filter function in Javascript with signature (config, vertex, path) -> mixed, where mixed can have one of the following values (or an array with multiple): “exclude” (do not visit the vertex), “prune” (do not follow the edges of the vertex), or “undefined” (visit the vertex and follow its edges).

  • visitor_func (str | None) – Visitor function in Javascript with signature (config, result, vertex, path, connected) -> void. The return value is ignored, result is modified by reference, and connected is populated only when parameter order is set to “preorder-expander”.

  • expander_func (str | None) – Expander function in Javascript with signature (config, vertex, path) -> mixed. The function must return an array of connections for vertex. Each connection is an object with attributes “edge” and “vertex”.

Returns

Visited edges and vertices.

Return type

dict

Raises

python_aioarango.exceptions.GraphTraverseError – If traversal fails.

async has_vertex(vertex: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Check if the given vertex document exists in the graph.

Parameters
  • vertex (str | dict) – Vertex document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in vertex if present.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

Returns

True if vertex document exists, False otherwise.

Return type

bool

Raises
async vertex(vertex: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]][source]

Return a vertex document.

Parameters
  • vertex (str | dict) – Vertex document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in vertex if present.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

Returns

Vertex document or None if not found.

Return type

dict | None

Raises
async insert_vertex(collection: str, vertex: Dict[str, Any], sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Insert a new vertex document.

Parameters
  • collection (str) – Vertex collection name.

  • vertex (dict) – New vertex document to insert. If it has “_key” or “_id” field, its value is used as key of the new vertex (otherwise it is auto-generated). Any “_rev” field is ignored.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async update_vertex(vertex: Dict[str, Any], check_rev: bool = True, keep_none: bool = True, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Update a vertex document.

Parameters
  • vertex (dict) – Partial or full vertex document with updated values. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

  • keep_none (bool) – If set to True, fields with value None are retained in the document. If set to False, they are removed completely.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace_vertex(vertex: Dict[str, Any], check_rev: bool = True, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Replace a vertex document.

Parameters
  • vertex (dict) – New vertex document to replace the old one with. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async delete_vertex(vertex: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, sync: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Delete a vertex document.

Parameters
  • vertex (str | dict) – Vertex document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in vertex if present.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

True if vertex was deleted successfully, False if vertex was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool

Raises
async has_edge(edge: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Check if the given edge document exists in the graph.

Parameters
  • edge (str | dict) – Edge document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in edge if present.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

Returns

True if edge document exists, False otherwise.

Return type

bool

Raises
async edge(edge: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]][source]

Return an edge document.

Parameters
  • edge (str | dict) – Edge document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in edge if present.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

Returns

Edge document or None if not found.

Return type

dict | None

Raises
async insert_edge(collection: str, edge: Dict[str, Any], sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Insert a new edge document.

Parameters
  • collection (str) – Edge collection name.

  • edge (dict) – New edge document to insert. It must contain “_from” and “_to” fields. If it has “_key” or “_id” field, its value is used as key of the new edge document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async update_edge(edge: Dict[str, Any], check_rev: bool = True, keep_none: bool = True, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Update an edge document.

Parameters
  • edge (dict) – Partial or full edge document with updated values. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. If set to False, they are removed completely.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace_edge(edge: Dict[str, Any], check_rev: bool = True, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Replace an edge document.

Parameters
  • edge (dict) – New edge document to replace the old one with. It must contain the “_id” field. It must also contain the “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async delete_edge(edge: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, sync: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Delete an edge document.

Parameters
  • edge (str | dict) – Edge document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in edge if present.

  • check_rev (bool) – If set to True, revision of edge (if given) is compared against the revision of target edge document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

True if edge was deleted successfully, False if edge was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool

Raises

Insert a new edge document linking the given vertices.

Parameters
  • collection (str) – Edge collection name.

  • from_vertex (str | dict) – “From” vertex document ID or body with “_id” field.

  • to_vertex (str | dict) – “To” vertex document ID or body with “_id” field.

  • data (dict) – Any extra data for the new edge document. If it has “_key” or “_id” field, its value is used as key of the new edge document (otherwise it is auto-generated).

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async edges(collection: str, vertex: Union[str, Dict[str, Any]], direction: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the edge documents coming in and/or out of given vertex.

Parameters
  • collection (str) – Edge collection name.

  • vertex (str | dict) – Vertex document ID or body with “_id” field.

  • direction (str) – The direction of the edges. Allowed values are “in” and “out”. If not set, edges in both directions are returned.

Returns

List of edges and statistics.

Return type

dict

Raises

python_aioarango.exceptions.EdgeListError – If retrieval fails.

HTTPClient

class python_aioarango.http.HTTPClient[source]

Abstract base class for HTTP clients.

abstract create_session(host: str) httpx.AsyncClient[source]

Return a new requests session given the host URL.

This method must be overridden by the user.

Parameters

host (str) – ArangoDB host URL.

Returns

httpx client object.

Return type

httpx.AsyncClient

abstract async send_request(session: httpx.AsyncClient, method: str, url: str, headers: Optional[MutableMapping[str, str]] = None, params: Optional[MutableMapping[str, str]] = None, data: Optional[str] = None, auth: Optional[Tuple[str, str]] = None) python_aioarango.response.Response[source]

Send an HTTP request.

This method must be overridden by the user.

Parameters
  • session (httpx.AsyncClient) – httpx session object.

  • method (str) – HTTP method in lowercase (e.g. “post”).

  • url (str) – Request URL.

  • headers (dict) – Request headers.

  • params (dict) – URL (query) parameters.

  • data (str | None) – Request payload.

  • auth (tuple) – Username and password.

Returns

HTTP response.

Return type

python_aioarango.response.Response

Pregel

class python_aioarango.pregel.Pregel(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]

Pregel API wrapper.

async job(job_id: int) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the details of a Pregel job.

Parameters

job_id (int) – Pregel job ID.

Returns

Details of the Pregel job.

Return type

dict

Raises

python_aioarango.exceptions.PregelJobGetError – If retrieval fails.

async create_job(graph: str, algorithm: str, store: bool = True, max_gss: Optional[int] = None, thread_count: Optional[int] = None, async_mode: Optional[bool] = None, result_field: Optional[str] = None, algorithm_params: Optional[Dict[str, Any]] = None) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]][source]

Start a new Pregel job.

Parameters
  • graph (str) – Graph name.

  • algorithm (str) – Algorithm (e.g. “pagerank”).

  • store (bool) – If set to True, Pregel engine writes results back to the database. If set to False, results can be queried via AQL.

  • max_gss (int | None) – Max number of global iterations for the algorithm.

  • thread_count (int | None) – Number of parallel threads to use per worker. This does not influence the number of threads used to load or store data from the database (it depends on the number of shards).

  • async_mode (bool | None) – If set to True, algorithms which support async mode run without synchronized global iterations. This might lead to performance increase if there are load imbalances.

  • result_field (str | None) – If specified, most algorithms will write their results into this field.

  • algorithm_params (dict | None) – Additional algorithm parameters.

Returns

Pregel job ID.

Return type

int

Raises

python_aioarango.exceptions.PregelJobCreateError – If create fails.

async delete_job(job_id: int) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Delete a Pregel job.

Parameters

job_id (int) – Pregel job ID.

Returns

True if Pregel job was deleted successfully.

Return type

bool

Raises

python_aioarango.exceptions.PregelJobDeleteError – If delete fails.

Replication

class python_aioarango.replication.Replication(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]
async inventory(batch_id: str, include_system: Optional[bool] = None, all_databases: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return an overview of collections and indexes.

Parameters
  • batch_id (str) – Batch ID.

  • include_system (bool | None) – Include system collections in the result. Default value is True.

  • all_databases (bool | None) – Include all databases. Only works on “_system” database. Default value is False.

Returns

Overview of collections and indexes.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationInventoryError – If retrieval fails.

async create_dump_batch(ttl: Optional[int] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Create a new dump batch.

Parameters

ttl (int | None) – Time-to-live for the new batch in seconds.

Returns

ID of the batch.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationDumpBatchCreateError – If create fails.

async delete_dump_batch(batch_id: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Delete a dump batch.

Parameters

batch_id (str) – Dump batch ID.

Returns

True if deletion was successful.

Return type

bool

Raises

python_aioarango.exceptions.ReplicationDumpBatchDeleteError – If delete fails.

async extend_dump_batch(batch_id: str, ttl: int) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Extend a dump batch.

Parameters
  • batch_id (str) – Dump batch ID.

  • ttl (int) – Time-to-live for the new batch in seconds.

Returns

True if operation was successful.

Return type

bool

Raises

python_aioarango.exceptions.ReplicationDumpBatchExtendError – If dump fails.

async dump(collection: str, batch_id: Optional[str] = None, chunk_size: Optional[int] = None, deserialize: bool = False) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the events data of one collection.

Parameters
  • collection (str) – Name or ID of the collection to dump.

  • batch_id (str | None) – Batch ID.

  • chunk_size (int | None) – Size of the result in bytes. This value is honored approximately only.

  • deserialize (bool) – Deserialize the response content. Default is False.

Returns

Collection events data.

Return type

str | [dict]

Raises

python_aioarango.exceptions.ReplicationDumpError – If retrieval fails.

async synchronize(endpoint: str, database: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, include_system: Optional[bool] = None, incremental: Optional[bool] = None, restrict_type: Optional[str] = None, restrict_collections: Optional[Sequence[str]] = None, initial_sync_wait_time: Optional[int] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Synchronize data from a remote endpoint.

Parameters
  • endpoint (str) – Master endpoint (e.g. “tcp://192.168.173.13:8529”).

  • database (str | None) – Database name.

  • username (str | None) – Username.

  • password (str | None) – Password.

  • include_system (bool | None) – Whether to include system collection operations.

  • incremental (bool | None) – If set to True, then an incremental synchronization method is used for synchronizing data in collections. This method is useful when collections already exist locally, and only the remaining differences need to be transferred from the remote endpoint. In this case, the incremental synchronization can be faster than a full synchronization. Default value is False, meaning complete data is transferred.

  • restrict_type (str | None) – Optional string value for collection filtering. Allowed values are “include” or “exclude”.

  • restrict_collections ([str] | None) – Optional list of collections for use with argument restrict_type. If restrict_type set to “include”, only the specified collections are synchronised. Otherwise, all but the specified ones are synchronized.

  • initial_sync_wait_time (int | None) – Maximum wait time in seconds that the initial synchronization will wait for a response from master when fetching collection data. This can be used to control after what time the initial synchronization will give up waiting for response and fail. Value is ignored if set to 0.

Returns

Collections transferred and last log tick.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationSyncError – If sync fails.

async cluster_inventory(include_system: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return an overview of collections and indexes in a cluster.

Parameters

include_system (bool) – Include system collections in the result. Default value is True.

Returns

Overview of collections and indexes on the cluster.

Return type

dict

:raise python_aioarango.exceptions.ReplicationClusterInventoryError:If retrieval fails.

async logger_state() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the state of the replication logger.

Returns

Logger state.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationLoggerStateError – If retrieval fails.

async logger_first_tick() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return the first available tick value from the server.

Returns

First tick value.

Return type

str

Raises

python_aioarango.exceptions.ReplicationLoggerFirstTickError – If retrieval fails.

async applier_config() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the configuration of the replication applier.

Returns

Configuration of the replication applier.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationApplierConfigError – If retrieval fails.

async set_applier_config(endpoint: str, database: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, max_connect_retries: Optional[int] = None, connect_timeout: Optional[int] = None, request_timeout: Optional[int] = None, chunk_size: Optional[int] = None, auto_start: Optional[bool] = None, adaptive_polling: Optional[bool] = None, include_system: Optional[bool] = None, auto_resync: Optional[bool] = None, auto_resync_retries: Optional[int] = None, initial_sync_max_wait_time: Optional[int] = None, connection_retry_wait_time: Optional[int] = None, idle_min_wait_time: Optional[int] = None, idle_max_wait_time: Optional[int] = None, require_from_present: Optional[bool] = None, verbose: Optional[bool] = None, restrict_type: Optional[str] = None, restrict_collections: Optional[Sequence[str]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Set configuration values of the replication applier.

Parameters
  • endpoint (str) – Server endpoint (e.g. “tcp://192.168.173.13:8529”).

  • database (str | None) – Database name.

  • username (str | None) – Username.

  • password (str | None) – Password.

  • max_connect_retries (int | None) – Maximum number of connection attempts the applier makes in a row before stopping itself.

  • connect_timeout (int | None) – Timeout in seconds when attempting to connect to the endpoint. This value is used for each connection attempt.

  • request_timeout (int | None) – Timeout in seconds for individual requests to the endpoint.

  • chunk_size (int | None) – Requested maximum size in bytes for log transfer packets when the endpoint is contacted.

  • auto_start (bool | None) – Whether to auto-start the replication applier on (next and following) server starts.

  • adaptive_polling (bool | None) – If set to True, replication applier sleeps for an increasingly long period in case the logger server at the endpoint has no replication events to apply. Using adaptive polling reduces the amount of work done by both the applier and the logger server when there are infrequent changes. The downside is that it might take longer for the replication applier to detect new events.

  • include_system (bool | None) – Whether system collection operations are applied.

  • auto_resync (bool | None) – Whether the slave should perform a full automatic resynchronization with the master in case the master cannot serve log data requested by the slave, or when the replication is started and no tick value can be found.

  • auto_resync_retries (int | None) – Max number of resynchronization retries. Setting this to 0 disables it.

  • initial_sync_max_wait_time (int | None) – Max wait time in seconds the initial synchronization waits for master on collection data. This value is relevant even for continuous replication when auto_resync is set to True because this may re-start the initial synchronization when master cannot provide log data slave requires. This value is ignored if set to 0.

  • connection_retry_wait_time (int | None) – Time in seconds the applier idles before trying to connect to master in case of connection problems. This value is ignored if set to 0.

  • idle_min_wait_time (int | None) – Minimum wait time in seconds the applier idles before fetching more log data from the master in case the master has already sent all its log data. This wait time can be used to control the frequency with which the replication applier sends HTTP log fetch requests to the master in case there is no write activity on the master. This value is ignored if set to 0.

  • idle_max_wait_time (int | None) – Maximum wait time in seconds the applier idles before fetching more log data from the master in case the master has already sent all its log data. This wait time can be used to control the maximum frequency with which the replication applier sends HTTP log fetch requests to the master in case there is no write activity on the master. Applies only when argument adaptive_polling is set to True. This value is ignored if set to 0.

  • require_from_present (bool | None) – If set to True, replication applier checks at start whether the start tick from which it starts or resumes replication is still present on the master. If not, then there would be data loss. If set to True, the replication applier aborts with an appropriate error message. If set to False, the applier still starts and ignores the data loss.

  • verbose (bool | None) – If set to True, a log line is emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.

  • restrict_type (str | None) – Optional string value for collection filtering. Allowed values are “include” or “exclude”.

  • restrict_collections ([str] | None) – Optional list of collections for use with argument restrict_type. If restrict_type set to “include”, only the specified collections are included. Otherwise, only the specified collections are excluded.

Returns

Updated configuration.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationApplierConfigSetError – If update fails.

async applier_state() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the state of the replication applier

Returns

Applier state and details.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationApplierStateError – If retrieval fails.

async start_applier(last_tick: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Start the replication applier.

Parameters

last_tick (str) – The remote last log tick value from which to start applying replication. If not specified, the last saved tick from the previous applier run is used. If there is no previous applier state saved, the applier starts at the beginning of the logger server’s log.

Returns

Applier state and details.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationApplierStartError – If operation fails.

async stop_applier() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Stop the replication applier.

Returns

Applier state and details.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationApplierStopError – If operation fails.

async make_slave(endpoint: str, database: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, restrict_type: Optional[str] = None, restrict_collections: Optional[Sequence[str]] = None, include_system: Optional[bool] = None, max_connect_retries: Optional[int] = None, connect_timeout: Optional[int] = None, request_timeout: Optional[int] = None, chunk_size: Optional[int] = None, adaptive_polling: Optional[bool] = None, auto_resync: Optional[bool] = None, auto_resync_retries: Optional[int] = None, initial_sync_max_wait_time: Optional[int] = None, connection_retry_wait_time: Optional[int] = None, idle_min_wait_time: Optional[int] = None, idle_max_wait_time: Optional[int] = None, require_from_present: Optional[bool] = None, verbose: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Change the server role to slave.

Parameters
  • endpoint (str) – Master endpoint (e.g. “tcp://192.168.173.13:8529”).

  • database (str | None) – Database name.

  • username (str | None) – Username.

  • password (str | None) – Password.

  • restrict_type (str | None) – Optional string value for collection filtering. Allowed values are “include” or “exclude”.

  • restrict_collections ([str] | None) – Optional list of collections for use with argument restrict_type. If restrict_type set to “include”, only the specified collections are included. Otherwise, only the specified collections are excluded.

  • include_system (bool | None) – Whether system collection operations are applied.

  • max_connect_retries (int | None) – Maximum number of connection attempts the applier makes in a row before stopping itself.

  • connect_timeout (int | None) – Timeout in seconds when attempting to connect to the endpoint. This value is used for each connection attempt.

  • request_timeout (int | None) – Timeout in seconds for individual requests to the endpoint.

  • chunk_size (int | None) – Requested maximum size in bytes for log transfer packets when the endpoint is contacted.

  • adaptive_polling (bool | None) – If set to True, replication applier sleeps for an increasingly long period in case the logger server at the endpoint has no replication events to apply. Using adaptive polling reduces the amount of work done by both the applier and the logger server when there are infrequent changes. The downside is that it might take longer for the replication applier to detect new events.

  • auto_resync (bool | None) – Whether the slave should perform a full automatic resynchronization with the master in case the master cannot serve log data requested by the slave, or when the replication is started and no tick value can be found.

  • auto_resync_retries (int | None) – Max number of resynchronization retries. Setting this to 0 disables it.

  • initial_sync_max_wait_time (int | None) – Max wait time in seconds the initial synchronization waits for master on collection data. This value is relevant even for continuous replication when auto_resync is set to True because this may restart the initial synchronization when master cannot provide log data slave requires. This value is ignored if set to 0.

  • connection_retry_wait_time (int | None) – Time in seconds the applier idles before trying to connect to master in case of connection problems. This value is ignored if set to 0.

  • idle_min_wait_time (int | None) – Minimum wait time in seconds the applier idles before fetching more log data from the master in case the master has already sent all its log data. This wait time can be used to control the frequency with which the replication applier sends HTTP log fetch requests to the master in case there is no write activity on the master. This value is ignored if set to 0.

  • idle_max_wait_time (int | None) – Maximum wait time in seconds the applier idles before fetching more log data from the master in case the master has already sent all its log data. This wait time can be used to control the maximum frequency with which the replication applier sends HTTP log fetch requests to the master in case there is no write activity on the master. Applies only when argument adaptive_polling is set to True. This value is ignored if set to 0.

  • require_from_present (bool | None) – If set to True, replication applier checks at start whether the start tick from which it starts or resumes replication is still present on the master. If not, then there would be data loss. If set to True, the replication applier aborts with an appropriate error message. If set to False, the applier still starts and ignores the data loss.

  • verbose (bool | None) – If set to True, a log line is emitted for all operations performed by the replication applier. This should be used for debugging replication problems only.

Returns

Replication details.

Return type

dict

Raises

python_aioarango.exceptions.ReplicationApplierStopError – If operation fails.

async server_id() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]][source]

Return this server’s ID.

Returns

Server ID.

Return type

str

Raises

python_aioarango.exceptions.ReplicationServerIDError – If retrieval fails.

Request

class python_aioarango.request.Request(method: str, endpoint: str, headers: Optional[MutableMapping[str, str]] = None, params: Optional[MutableMapping[str, Union[bool, int, str]]] = None, data: Optional[Any] = None, read: Optional[Union[str, Sequence[str]]] = None, write: Optional[Union[str, Sequence[str]]] = None, exclusive: Optional[Union[str, Sequence[str]]] = None, deserialize: bool = True)[source]

HTTP request.

Parameters
  • method (str) – HTTP method in lowercase (e.g. “post”).

  • endpoint (str) – API endpoint.

  • headers (dict | None) – Request headers.

  • params (dict | None) – URL parameters.

  • data (str | bool | int | float | list | dict | None | MultipartEncoder) – Request payload.

  • read (str | [str] | None) – Names of collections read during transaction.

  • write (str | [str] | None) – Name(s) of collections written to during transaction with shared access.

  • exclusive (str | [str] | None) – Name(s) of collections written to during transaction with exclusive access.

  • deserialize (bool) – Whether the response body can be deserialized.

Variables
  • method (str) – HTTP method in lowercase (e.g. “post”).

  • endpoint (str) – API endpoint.

  • headers (dict | None) – Request headers.

  • params (dict | None) – URL (query) parameters.

  • data (str | bool | int | float | list | dict | None) – Request payload.

  • read (str | [str] | None) – Names of collections read during transaction.

  • write (str | [str] | None) – Name(s) of collections written to during transaction with shared access.

  • exclusive (str | [str] | None) – Name(s) of collections written to during transaction with exclusive access.

  • deserialize (bool) – Whether the response body can be deserialized.

Response

class python_aioarango.response.Response(method: str, url: str, headers: MutableMapping[str, str], status_code: int, status_text: str, raw_body: str)[source]

HTTP response.

Parameters
  • method (str) – HTTP method in lowercase (e.g. “post”).

  • url (str) – API URL.

  • headers (MutableMapping) – Response headers.

  • status_code (int) – Response status code.

  • status_text (str) – Response status text.

  • raw_body (str) – Raw response body.

Variables
  • method (str) – HTTP method in lowercase (e.g. “post”).

  • url (str) – API URL.

  • headers (MutableMapping) – Response headers.

  • status_code (int) – Response status code.

  • status_text (str) – Response status text.

  • raw_body (str) – Raw response body.

  • body (str | bool | int | float | list | dict | None) – JSON-deserialized response body.

  • error_code (int) – Error code from ArangoDB server.

  • error_message (str) – Error message from ArangoDB server.

  • is_success (bool) – True if response status code was 2XX.

StandardCollection

class python_aioarango.collection.StandardCollection(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor], name: str)[source]

Standard ArangoDB collection API wrapper.

async get(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]][source]

Return a document.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

Document, or None if not found.

Return type

dict | None

Raises
async insert(document: Dict[str, Any], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False, overwrite_mode: Optional[str] = None, keep_none: Optional[bool] = None, merge: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Insert a new document.

Parameters
  • document (dict) – Document to insert. If it contains the “_key” or “_id” field, the value is used as the key of the new document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate key and existing document is overwritten (replace-insert).

  • return_old (bool) – Include body of the old document if overwritten. Ignored if parameter silent is set to True.

  • overwrite_mode (str | None) – Overwrite behavior used when the document key exists already. Allowed values are “replace” (replace-insert) or “update” (update-insert). Implicitly sets the value of parameter overwrite.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely. Applies only when overwrite_mode is set to “update” (update-insert).

  • merge (bool | None) – If set to True (default), sub-dictionaries are merged instead of the new one overwriting the old one. Applies only when overwrite_mode is set to “update” (update-insert).

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async update(document: Dict[str, Any], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Update a document.

Parameters
  • document (dict) – Partial or full document with the updated values. It must contain the “_id” or “_key” field.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new one overwriting the old one.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace(document: Dict[str, Any], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Replace a document.

Parameters
  • document (dict) – New document to replace the old one with. It must contain the “_id” or “_key” field. Edge document must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async delete(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Delete a document.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision), or True if parameter silent was set to True, or False if document was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool | dict

Raises
async add_fulltext_index(fields: Sequence[str], min_length: Optional[int] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new fulltext index.

Parameters
  • fields ([str]) – Document fields to index.

  • min_length (int | None) – Minimum number of characters to index.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_geo_index(fields: Union[str, Sequence[str]], ordered: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new geo-spatial index.

Parameters
  • fields (str | [str]) – A single document field or a list of document fields. If a single field is given, the field must have values that are lists with at least two floats. Documents with missing fields or invalid values are excluded.

  • ordered (bool | None) – Whether the order is longitude, then latitude.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_hash_index(fields: Sequence[str], unique: Optional[bool] = None, sparse: Optional[bool] = None, deduplicate: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new hash index.

Parameters
  • fields ([str]) – Document fields to index.

  • unique (bool | None) – Whether the index is unique.

  • sparse (bool | None) – If set to True, documents with None in the field are also indexed. If set to False, they are skipped.

  • deduplicate (bool | None) – If set to True, inserting duplicate index values from the same document triggers unique constraint errors.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_persistent_index(fields: Sequence[str], unique: Optional[bool] = None, sparse: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new persistent index.

Unique persistent indexes on non-sharded keys are not supported in a cluster.

Parameters
  • fields ([str]) – Document fields to index.

  • unique (bool | None) – Whether the index is unique.

  • sparse (bool | None) – Exclude documents that do not contain at least one of the indexed fields, or documents that have a value of None in any of the indexed fields.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_skiplist_index(fields: Sequence[str], unique: Optional[bool] = None, sparse: Optional[bool] = None, deduplicate: Optional[bool] = None, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new skiplist index.

Parameters
  • fields ([str]) – Document fields to index.

  • unique (bool | None) – Whether the index is unique.

  • sparse (bool | None) – If set to True, documents with None in the field are also indexed. If set to False, they are skipped.

  • deduplicate (bool | None) – If set to True, inserting duplicate index values from the same document triggers unique constraint errors.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async add_ttl_index(fields: Sequence[str], expiry_time: int, name: Optional[str] = None, in_background: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new TTL (time-to-live) index.

Parameters
  • fields ([str]) – Document field to index.

  • expiry_time (int) – Time of expiry in seconds after document creation.

  • name (str | None) – Optional name for the index.

  • in_background (bool | None) – Do not hold the collection lock.

Returns

New index details.

Return type

dict

Raises

python_aioarango.exceptions.IndexCreateError – If create fails.

async all(skip: Optional[int] = None, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return all documents in the collection.

Parameters
  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async checksum(with_rev: bool = False, with_data: bool = False) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return collection checksum.

Parameters
  • with_rev (bool) – Include document revisions in checksum calculation.

  • with_data (bool) – Include document data in checksum calculation.

Returns

Collection checksum.

Return type

str

Raises

python_aioarango.exceptions.CollectionChecksumError – If retrieval fails.

async configure(sync: Optional[bool] = None, schema: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Configure collection properties.

Parameters
  • sync (bool | None) – Block until operations are synchronized to disk.

  • schema (dict) – document schema for validation of objects.

Returns

New collection properties.

Return type

dict

Raises

python_aioarango.exceptions.CollectionConfigureError – If operation fails.

property conn: Union[BaseConnection, JwtConnection, JwtSuperuserConnection]

Return the HTTP connection.

Returns

HTTP connection.

Return type

python_aioarango.connection.BasicConnection | python_aioarango.connection.JwtConnection | python_aioarango.connection.JwtSuperuserConnection

property context: str

Return the API execution context.

Returns

API execution context. Possible values are “default”, “async”, “batch” and “transaction”.

Return type

str

async count() Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]]

Return the total document count.

Returns

Total document count.

Return type

int

Raises

python_aioarango.exceptions.DocumentCountError – If retrieval fails.

property db_name: str

Return the name of the current database.

Returns

Database name.

Return type

str

async delete_index(index_id: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete an index.

Parameters
  • index_id (str) – Index ID.

  • ignore_missing (bool) – Do not raise an exception on missing index.

Returns

True if index was deleted successfully, False if index was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.IndexDeleteError – If delete fails.

async delete_many(documents: Sequence[Dict[str, Any]], return_old: bool = False, check_rev: bool = True, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]]

Delete multiple documents.

Note

If deleting a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were deleted successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single delete operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([str | dict]) – Document IDs, keys or bodies. Document bodies must contain the “_id” or “_key” fields.

  • return_old (bool) – Include bodies of the old documents in the result.

  • check_rev (bool) – If set to True, revisions of documents (if given) are compared against the revisions of target documents.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

List of document metadata (e.g. document keys, revisions) and any exceptions, or True if parameter silent was set to True.

Return type

[dict | ArangoServerError] | bool

Raises

python_aioarango.exceptions.DocumentDeleteError – If delete fails.

async delete_match(filters: Dict[str, Any], limit: Optional[int] = None, sync: Optional[bool] = None) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]]

Delete matching documents.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single delete operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • filters (dict) – Document filters.

  • limit (int | None) – Max number of documents to delete. If the limit is lower than the number of matched documents, random documents are chosen.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

Number of documents deleted.

Return type

int

Raises

python_aioarango.exceptions.DocumentDeleteError – If delete fails.

async export(limit: Optional[int] = None, count: bool = False, batch_size: Optional[int] = None, flush: bool = False, flush_wait: Optional[int] = None, ttl: Optional[numbers.Number] = None, filter_fields: Optional[Sequence[str]] = None, filter_type: str = 'include') Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Export all documents in the collection using a server cursor.

Parameters
  • flush (bool) – If set to True, flush the write-ahead log prior to the export. If set to False, documents in the write-ahead log during the export are not included in the result.

  • flush_wait (int | None) – Max wait time in seconds for write-ahead log flush.

  • count (bool) – Include the document count in the server cursor.

  • batch_size (int | None) – Max number of documents in the batch fetched by the cursor in one round trip.

  • limit (int | None) – Max number of documents fetched by the cursor.

  • ttl (int | float | None) – Time-to-live for the cursor on the server.

  • filter_fields ([str] | None) – Document fields to filter with.

  • filter_type (str) – Allowed values are “include” or “exclude”.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If export fails.

async find(filters: Dict[str, Any], skip: Optional[int] = None, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return all documents that match the given filters.

Parameters
  • filters (dict) – Document filters.

  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_by_text(field: str, query: str, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return documents that match the given fulltext query.

Parameters
  • field (str) – Document field with fulltext index.

  • query (str) – Fulltext query.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_in_box(latitude1: numbers.Number, longitude1: numbers.Number, latitude2: numbers.Number, longitude2: numbers.Number, skip: Optional[int] = None, limit: Optional[int] = None, index: Optional[str] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return all documents in an rectangular area.

Parameters
  • latitude1 (int | float) – First latitude.

  • longitude1 (int | float) – First longitude.

  • latitude2 (int | float) – Second latitude.

  • longitude2 (int | float) – Second longitude

  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

  • index (str | None) – ID of the geo index to use (without the collection prefix). This parameter is ignored in transactions.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_in_radius(latitude: numbers.Number, longitude: numbers.Number, radius: numbers.Number, distance_field: Optional[str] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return documents within a given radius around a coordinate.

A geo index must be defined in the collection to use this method.

Parameters
  • latitude (int | float) – Latitude.

  • longitude (int | float) – Longitude.

  • radius (int | float) – Max radius.

  • distance_field (str) – Document field used to indicate the distance to the given coordinate. This parameter is ignored in transactions.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_in_range(field: str, lower: int, upper: int, skip: Optional[int] = None, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return documents within a given range in a random order.

A skiplist index must be defined in the collection to use this method.

Parameters
  • field (str) – Document field name.

  • lower (int) – Lower bound (inclusive).

  • upper (int) – Upper bound (exclusive).

  • skip (int | None) – Number of documents to skip.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async find_near(latitude: numbers.Number, longitude: numbers.Number, limit: Optional[int] = None) Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return documents near a given coordinate.

Documents returned are sorted according to distance, with the nearest document being the first. If there are documents of equal distance, they are randomly chosen from the set until the limit is reached. A geo index must be defined in the collection to use this method.

Parameters
  • latitude (int | float) – Latitude.

  • longitude (int | float) – Longitude.

  • limit (int | None) – Max number of documents returned.

Returns

Document cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async get_many(documents: Sequence[Union[str, Dict[str, Any]]]) Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return multiple documents ignoring any missing ones.

Parameters

documents ([str | dict]) – List of document keys, IDs or bodies. Document bodies must contain the “_id” or “_key” fields.

Returns

Documents. Missing ones are not included.

Return type

[dict]

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async has(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a document exists in the collection.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

True if document exists, False otherwise.

Return type

bool

Raises
async ids() Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return the IDs of all documents in the collection.

Returns

Document ID cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentIDsError – If retrieval fails.

async import_bulk(documents: Sequence[Dict[str, Any]], halt_on_error: bool = True, details: bool = True, from_prefix: Optional[str] = None, to_prefix: Optional[str] = None, overwrite: Optional[bool] = None, on_duplicate: Optional[str] = None, sync: Optional[bool] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Insert multiple documents into the collection.

Note

This method is faster than python_aioarango.collection.Collection.insert_many() but does not return as many details.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single insert operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – List of new documents to insert. If they contain the “_key” or “_id” fields, the values are used as the keys of the new documents (auto-generated otherwise). Any “_rev” field is ignored.

  • halt_on_error (bool) – Halt the entire import on an error.

  • details (bool) – If set to True, the returned result will include an additional list of detailed error messages.

  • from_prefix (str) – String prefix prepended to the value of “_from” field in each edge document inserted. For example, prefix “foo” prepended to “_from”: “bar” will result in “_from”: “foo/bar”. Applies only to edge collections.

  • to_prefix (str) – String prefix prepended to the value of “_to” field in edge document inserted. For example, prefix “foo” prepended to “_to”: “bar” will result in “_to”: “foo/bar”. Applies only to edge collections.

  • overwrite (bool) – If set to True, all existing documents are removed prior to the import. Indexes are still preserved.

  • on_duplicate (str) – Action to take on unique key constraint violations (for documents with “_key” fields). Allowed values are “error” (do not import the new documents and count them as errors), “update” (update the existing documents while preserving any fields missing in the new ones), “replace” (replace the existing documents with new ones), and “ignore” (do not import the new documents and count them as ignored, as opposed to counting them as errors). Options “update” and “replace” may fail on secondary unique key constraint violations.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

Result of the bulk import.

Return type

dict

Raises

python_aioarango.exceptions.DocumentInsertError – If import fails.

async indexes() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return the collection indexes.

Returns

Collection indexes.

Return type

[dict]

Raises

python_aioarango.exceptions.IndexListError – If retrieval fails.

async insert_many(documents: Sequence[Dict[str, Any]], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]]

Insert multiple documents.

Note

If inserting a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were inserted successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single insert operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – List of new documents to insert. If they contain the “_key” or “_id” fields, the values are used as the keys of the new documents (auto-generated otherwise). Any “_rev” field is ignored.

  • return_new (bool) – Include bodies of the new documents in the returned metadata. Ignored if parameter silent is set to True

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate keys and the existing documents are replaced.

  • return_old (bool) – Include body of the old documents if replaced. Applies only when value of overwrite is set to True.

Returns

List of document metadata (e.g. document keys, revisions) and any exception, or True if parameter silent was set to True.

Return type

[dict | ArangoServerError] | bool

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async keys() Optional[Union[python_aioarango.cursor.Cursor, python_aioarango.job.AsyncJob[python_aioarango.cursor.Cursor], python_aioarango.job.BatchJob[python_aioarango.cursor.Cursor]]]

Return the keys of all documents in the collection.

Returns

Document key cursor.

Return type

python_aioarango.cursor.Cursor

Raises

python_aioarango.exceptions.DocumentKeysError – If retrieval fails.

async load() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Load the collection into memory.

Returns

True if collection was loaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionLoadError – If operation fails.

async load_indexes() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Cache all indexes in the collection into memory.

Returns

True if index was loaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.IndexLoadError – If operation fails.

property name: str

Return collection name.

Returns

Collection name.

Return type

str

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return collection properties.

Returns

Collection properties.

Return type

dict

Raises

python_aioarango.exceptions.CollectionPropertiesError – If retrieval fails.

async random() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return a random document from the collection.

Returns

A random document.

Return type

dict

Raises

python_aioarango.exceptions.DocumentGetError – If retrieval fails.

async recalculate_count() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Recalculate the document count.

Returns

True if recalculation was successful.

Return type

bool

Raises

python_aioarango.exceptions.CollectionRecalculateCountError – If operation fails.

async rename(new_name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Rename the collection.

Renames may not be reflected immediately in async execution, batch execution or transactions. It is recommended to initialize new API wrappers after a rename.

Parameters

new_name (str) – New collection name.

Returns

True if collection was renamed successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionRenameError – If rename fails.

async replace_many(documents: Sequence[Dict[str, Any]], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]]

Replace multiple documents.

Note

If replacing a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were replaced successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single replace operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – New documents to replace the old ones with. They must contain the “_id” or “_key” fields. Edge documents must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revisions of documents (if given) are compared against the revisions of target documents.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

List of document metadata (e.g. document keys, revisions) and any exceptions, or True if parameter silent was set to True.

Return type

[dict | ArangoServerError] | bool

Raises

python_aioarango.exceptions.DocumentReplaceError – If replace fails.

async replace_match(filters: Dict[str, Any], body: Dict[str, Any], limit: Optional[int] = None, sync: Optional[bool] = None) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]]

Replace matching documents.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single replace operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • filters (dict) – Document filters.

  • body (dict) – New document body.

  • limit (int | None) – Max number of documents to replace. If the limit is lower than the number of matched documents, random documents are chosen.

  • sync (bool | None) – Block until operation is synchronized to disk.

Returns

Number of documents replaced.

Return type

int

Raises

python_aioarango.exceptions.DocumentReplaceError – If replace fails.

async responsible_shard(document: Dict[str, Any]) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return the ID of the shard responsible for given document.

If the document does not exist, return the shard that would be responsible.

Returns

Shard ID

Return type

str

async revision() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return collection revision.

Returns

Collection revision.

Return type

str

Raises

python_aioarango.exceptions.CollectionRevisionError – If retrieval fails.

async statistics() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return collection statistics.

Returns

Collection statistics.

Return type

dict

Raises

python_aioarango.exceptions.CollectionStatisticsError – If retrieval fails.

async truncate() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete all documents in the collection.

Returns

True if collection was truncated successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionTruncateError – If operation fails.

async unload() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Unload the collection from memory.

Returns

True if collection was unloaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.CollectionUnloadError – If operation fails.

async update_many(documents: Sequence[Dict[str, Any]], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]], python_aioarango.job.AsyncJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]], python_aioarango.job.BatchJob[Union[bool, List[Union[Dict[str, Any], python_aioarango.exceptions.ArangoServerError]]]]]]

Update multiple documents.

Note

If updating a document fails, the exception is not raised but returned as an object in the result list. It is up to you to inspect the list to determine which documents were updated successfully (returns document metadata) and which were not (returns exception object).

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single update operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • documents ([dict]) – Partial or full documents with the updated values. They must contain the “_id” or “_key” fields.

  • check_rev (bool) – If set to True, revisions of documents (if given) are compared against the revisions of target documents.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new ones overwriting the old ones.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

List of document metadata (e.g. document keys, revisions) and any exceptions, or True if parameter silent was set to True.

Return type

[dict | ArangoError] | bool

Raises

python_aioarango.exceptions.DocumentUpdateError – If update fails.

async update_match(filters: Dict[str, Any], body: Dict[str, Any], limit: Optional[int] = None, keep_none: bool = True, sync: Optional[bool] = None, merge: bool = True) Optional[Union[int, python_aioarango.job.AsyncJob[int], python_aioarango.job.BatchJob[int]]]

Update matching documents.

Note

In edge/vertex collections, this method does NOT provide the transactional guarantees and validations that single update operation does for graphs. If these properties are required, see python_aioarango.database.StandardDatabase.begin_batch_execution() for an alternative approach.

Parameters
  • filters (dict) – Document filters.

  • body (dict) – Full or partial document body with the updates.

  • limit (int | None) – Max number of documents to update. If the limit is lower than the number of matched documents, random documents are chosen. This parameter is not supported on sharded collections.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new ones overwriting the old ones.

Returns

Number of documents updated.

Return type

int

Raises

python_aioarango.exceptions.DocumentUpdateError – If update fails.

property username: Optional[str]

Return the username.

Returns

Username.

Return type

str

StandardDatabase

class python_aioarango.database.StandardDatabase(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection])[source]

Standard database API wrapper.

begin_async_execution(return_result: bool = True) python_aioarango.database.AsyncDatabase[source]

Begin async execution.

Parameters

return_result (bool) – If set to True, API executions return instances of python_aioarango.job.AsyncJob, which you can use to retrieve results from server once available. If set to False, API executions return None and no results are stored on server.

Returns

Database API wrapper object specifically for async execution.

Return type

python_aioarango.database.AsyncDatabase

begin_batch_execution(return_result: bool = True) python_aioarango.database.BatchDatabase[source]

Begin batch execution.

Parameters

return_result (bool) – If set to True, API executions return instances of python_aioarango.job.BatchJob that are populated with results on commit. If set to False, API executions return None and no results are tracked client-side.

Returns

Database API wrapper object specifically for batch execution.

Return type

python_aioarango.database.BatchDatabase

async begin_transaction(read: Optional[Union[str, Sequence[str]]] = None, write: Optional[Union[str, Sequence[str]]] = None, exclusive: Optional[Union[str, Sequence[str]]] = None, sync: Optional[bool] = None, allow_implicit: Optional[bool] = None, lock_timeout: Optional[int] = None, max_size: Optional[int] = None) python_aioarango.database.TransactionDatabase[source]

Begin a transaction.

Parameters
  • read (str | [str] | None) – Name(s) of collections read during transaction. Read-only collections are added lazily but should be declared if possible to avoid deadlocks.

  • write (str | [str] | None) – Name(s) of collections written to during transaction with shared access.

  • exclusive (str | [str] | None) – Name(s) of collections written to during transaction with exclusive access.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • allow_implicit (bool | None) – Allow reading from undeclared collections.

  • lock_timeout (int | None) – Timeout for waiting on collection locks. If not given, a default value is used. Setting it to 0 disables the timeout.

  • max_size (int | None) – Max transaction size in bytes.

Returns

Database API wrapper object specifically for transactions.

Return type

python_aioarango.database.TransactionDatabase

async analyzer(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return analyzer details.

Parameters

name (str) – Analyzer name.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerGetError – If retrieval fails.

async analyzers() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of analyzers.

Returns

List of analyzers.

Return type

[dict]

Raises

python_aioarango.exceptions.AnalyzerListError – If retrieval fails.

property aql: python_aioarango.aql.AQL

Return AQL (ArangoDB Query Language) API wrapper.

Returns

AQL API wrapper.

Return type

python_aioarango.aql.AQL

async async_jobs(status: str, count: Optional[int] = None) Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return IDs of async jobs with given status.

Parameters
  • status (str) – Job status (e.g. “pending”, “done”).

  • count (int) – Max number of job IDs to return.

Returns

List of job IDs.

Return type

[str]

Raises

python_aioarango.exceptions.AsyncJobListError – If retrieval fails.

property backup: python_aioarango.backup.Backup

Return Backup API wrapper.

Returns

Backup API wrapper.

Return type

python_aioarango.backup.Backup

async clear_async_jobs(threshold: Optional[int] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Clear async job results from the server.

Async jobs that are still queued or running are not stopped.

Parameters

threshold (int | None) – If specified, only the job results created prior to the threshold (a unix timestamp) are deleted. Otherwise, all job results are deleted.

Returns

True if job results were cleared successfully.

Return type

bool

Raises

python_aioarango.exceptions.AsyncJobClearError – If operation fails.

property cluster: python_aioarango.cluster.Cluster

Return Cluster API wrapper.

Returns

Cluster API wrapper.

Return type

python_aioarango.cluster.Cluster

collection(name: str) python_aioarango.collection.StandardCollection

Return the standard collection API wrapper.

Parameters

name (str) – Collection name.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

async collections() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return the collections in the database.

Returns

Collections in the database and their details.

Return type

[dict]

Raises

python_aioarango.exceptions.CollectionListError – If retrieval fails.

property conn: Union[BaseConnection, JwtConnection, JwtSuperuserConnection]

Return the HTTP connection.

Returns

HTTP connection.

Return type

python_aioarango.connection.BasicConnection | python_aioarango.connection.JwtConnection | python_aioarango.connection.JwtSuperuserConnection

property context: str

Return the API execution context.

Returns

API execution context. Possible values are “default”, “async”, “batch” and “transaction”.

Return type

str

async create_analyzer(name: str, analyzer_type: str, properties: Optional[Dict[str, Any]] = None, features: Optional[Sequence[str]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an analyzer.

Parameters
  • name (str) – Analyzer name.

  • analyzer_type (str) – Analyzer type.

  • properties (dict | None) – Analyzer properties.

  • features (list | None) – Analyzer features.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerCreateError – If create fails.

async create_arangosearch_view(name: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async create_collection(name: str, sync: bool = False, system: bool = False, edge: bool = False, user_keys: bool = True, key_increment: Optional[int] = None, key_offset: Optional[int] = None, key_generator: str = 'traditional', shard_fields: Optional[Sequence[str]] = None, shard_count: Optional[int] = None, replication_factor: Optional[int] = None, shard_like: Optional[str] = None, sync_replication: Optional[bool] = None, enforce_replication_factor: Optional[bool] = None, sharding_strategy: Optional[str] = None, smart_join_attribute: Optional[str] = None, write_concern: Optional[int] = None, schema: Optional[Dict[str, Any]] = None) Optional[Union[python_aioarango.collection.StandardCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.StandardCollection], python_aioarango.job.BatchJob[python_aioarango.collection.StandardCollection]]]

Create a new collection.

Parameters
  • name (str) – Collection name.

  • sync (bool | None) – If set to True, document operations via the collection will block until synchronized to disk by default.

  • system (bool) – If set to True, a system collection is created. The collection name must have leading underscore “_” character.

  • edge (bool) – If set to True, an edge collection is created.

  • key_generator (str) – Used for generating document keys. Allowed values are “traditional” or “autoincrement”.

  • user_keys (bool) – If set to True, users are allowed to supply document keys. If set to False, the key generator is solely responsible for supplying the key values.

  • key_increment (int) – Key increment value. Applies only when value of key_generator is set to “autoincrement”.

  • key_offset (int) – Key offset value. Applies only when value of key_generator is set to “autoincrement”.

  • shard_fields ([str]) – Field(s) used to determine the target shard.

  • shard_count (int) – Number of shards to create.

  • replication_factor (int) – Number of copies of each shard on different servers in a cluster. Allowed values are 1 (only one copy is kept and no synchronous replication), and n (n-1 replicas are kept and any two copies are replicated across servers synchronously, meaning every write to the master is copied to all slaves before operation is reported successful).

  • shard_like (str) – Name of prototype collection whose sharding specifics are imitated. Prototype collections cannot be dropped before imitating collections. Applies to enterprise version of ArangoDB only.

  • sync_replication (bool) – If set to True, server reports success only when collection is created in all replicas. You can set this to False for faster server response, and if full replication is not a concern.

  • enforce_replication_factor (bool) – Check if there are enough replicas available at creation time, or halt the operation.

  • sharding_strategy (str) – Sharding strategy. Available for ArangoDB version and up only. Possible values are “community-compat”, “enterprise-compat”, “enterprise-smart-edge-compat”, “hash” and “enterprise-hash-smart-edge”. Refer to ArangoDB documentation for more details on each value.

  • smart_join_attribute (str) – Attribute of the collection which must contain the shard key value of the smart join collection. The shard key for the documents must contain the value of this attribute, followed by a colon “:” and the primary key of the document. Requires parameter shard_like to be set to the name of another collection, and parameter shard_fields to be set to a single shard key attribute, with another colon “:” at the end. Available only for enterprise version of ArangoDB.

  • write_concern (int) – Write concern for the collection. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time. The value of this parameter cannot be larger than that of replication_factor. Default value is 1. Used for clusters only.

  • schema (dict) – Optional dict specifying the collection level schema for documents. See ArangoDB documentation for more information on document schema validation.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

Raises

python_aioarango.exceptions.CollectionCreateError – If create fails.

async create_database(name: str, users: Optional[Sequence[Dict[str, Any]]] = None, replication_factor: Optional[Union[int, str]] = None, write_concern: Optional[int] = None, sharding: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Create a new database.

Parameters
  • name (str) – Database name.

  • users ([dict]) – List of users with access to the new database, where each user is a dictionary with fields “username”, “password”, “active” and “extra” (see below for example). If not set, only the admin and current user are granted access.

  • replication_factor (int | str) – Default replication factor for collections created in this database. Special values include “satellite” which replicates the collection to every DBServer, and 1 which disables replication. Used for clusters only.

  • write_concern (int) – Default write concern for collections created in this database. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time, however. Value of this parameter can not be larger than the value of replication_factor. Used for clusters only.

  • sharding (str) – Sharding method used for new collections in this database. Allowed values are: “”, “flexible” and “single”. The first two are equivalent. Used for clusters only.

Returns

True if database was created successfully.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseCreateError – If create fails.

Here is an example entry for parameter users:

{
    'username': 'john',
    'password': 'password',
    'active': True,
    'extra': {'Department': 'IT'}
}
async create_graph(name: str, edge_definitions: Optional[Sequence[Dict[str, Any]]] = None, orphan_collections: Optional[Sequence[str]] = None, smart: Optional[bool] = None, smart_field: Optional[str] = None, shard_count: Optional[int] = None) Optional[Union[python_aioarango.graph.Graph, python_aioarango.job.AsyncJob[python_aioarango.graph.Graph], python_aioarango.job.BatchJob[python_aioarango.graph.Graph]]]

Create a new graph.

Parameters
  • name (str) – Graph name.

  • edge_definitions ([dict] | None) – List of edge definitions, where each edge definition entry is a dictionary with fields “edge_collection”, “from_vertex_collections” and “to_vertex_collections” (see below for example).

  • orphan_collections ([str] | None) – Names of additional vertex collections that are not in edge definitions.

  • smart (bool | None) – If set to True, sharding is enabled (see parameter smart_field below). Applies only to enterprise version of ArangoDB.

  • smart_field (str | None) – Document field used to shard the vertices of the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. Applies only to enterprise version of ArangoDB.

  • shard_count (int | None) – Number of shards used for every collection in the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. This number cannot be modified later once set. Applies only to enterprise version of ArangoDB.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

Raises

python_aioarango.exceptions.GraphCreateError – If create fails.

Here is an example entry for parameter edge_definitions:

{
    'edge_collection': 'teach',
    'from_vertex_collections': ['teachers'],
    'to_vertex_collections': ['lectures']
}
async create_task(name: str, command: str, params: Optional[Dict[str, Any]] = None, period: Optional[int] = None, offset: Optional[int] = None, task_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new server task.

Parameters
  • name (str) – Name of the server task.

  • command (str) – Javascript command to execute.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • period (int | None) – Number of seconds to wait between executions. If set to 0, the new task will be “timed”, meaning it will execute only once and be deleted afterwards.

  • offset (int | None) – Initial delay before execution in seconds.

  • task_id (str | None) – Pre-defined ID for the new server task.

Returns

Details of the new task.

Return type

dict

Raises

python_aioarango.exceptions.TaskCreateError – If create fails.

async create_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new user.

Parameters
  • username (str) – Username.

  • password (str | None) – Password.

  • active (bool | None) – True if user is active, False otherwise.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserCreateError – If create fails.

async create_view(name: str, view_type: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async databases() Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return the names all databases.

Returns

Database names.

Return type

[str]

Raises

python_aioarango.exceptions.DatabaseListError – If retrieval fails.

property db_name: str

Return the name of the current database.

Returns

Database name.

Return type

str

async delete_analyzer(name: str, force: bool = False, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete an analyzer.

Parameters
  • name (str) – Analyzer name.

  • force (bool) – Remove the analyzer configuration even if in use.

  • ignore_missing (bool) – Do not raise an exception on missing analyzer.

Returns

True if analyzer was deleted successfully, False if analyzer was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.AnalyzerDeleteError – If delete fails.

async delete_collection(name: str, ignore_missing: bool = False, system: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the collection.

Parameters
  • name (str) – Collection name.

  • ignore_missing (bool) – Do not raise an exception on missing collection.

  • system (bool) – Whether the collection is a system collection.

Returns

True if collection was deleted successfully, False if collection was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.CollectionDeleteError – If delete fails.

async delete_database(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the database.

Parameters
  • name (str) – Database name.

  • ignore_missing (bool) – Do not raise an exception on missing database.

Returns

True if database was deleted successfully, False if database was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseDeleteError – If delete fails.

async delete_document(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Delete a document.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision), or True if parameter silent was set to True, or False if document was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool | dict

Raises
async delete_graph(name: str, ignore_missing: bool = False, drop_collections: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Drop the graph of the given name from the database.

Parameters
  • name (str) – Graph name.

  • ignore_missing (bool) – Do not raise an exception on missing graph.

  • drop_collections (bool | None) – Drop the collections of the graph also. This is only if they are not in use by other graphs.

Returns

True if graph was deleted successfully, False if graph was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.GraphDeleteError – If delete fails.

async delete_task(task_id: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a server task.

Parameters
  • task_id (str) – Server task ID.

  • ignore_missing (bool) – Do not raise an exception on missing task.

Returns

True if task was successfully deleted, False if task was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.TaskDeleteError – If delete fails.

async delete_user(username: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a user.

Parameters
  • username (str) – Username.

  • ignore_missing (bool) – Do not raise an exception on missing user.

Returns

True if user was deleted successfully, False if user was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.UserDeleteError – If delete fails.

async delete_view(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a view.

Parameters
  • name (str) – View name.

  • ignore_missing (bool) – Do not raise an exception on missing view.

Returns

True if view was deleted successfully, False if view was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.ViewDeleteError – If delete fails.

async details() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server details.

Returns

Server details.

Return type

dict

Raises

python_aioarango.exceptions.ServerDetailsError – If retrieval fails.

async document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]]

Return a document.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

Document, or None if not found.

Return type

dict | None

Raises
async echo() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return details of the last request (e.g. headers, payload).

Returns

Details of the last request.

Return type

dict

Raises

python_aioarango.exceptions.ServerEchoError – If retrieval fails.

async encryption() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Rotate the user-supplied keys for encryption.

This method is available only for enterprise edition of ArangoDB.

Returns

New TLS data.

Return type

dict

Raises

python_aioarango.exceptions.ServerEncryptionError – If retrieval fails.

async engine() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the database engine details.

Returns

Database engine details.

Return type

dict

Raises

python_aioarango.exceptions.ServerEngineError – If retrieval fails.

async execute_transaction(command: str, params: Optional[Dict[str, Any]] = None, read: Optional[Sequence[str]] = None, write: Optional[Sequence[str]] = None, sync: Optional[bool] = None, timeout: Optional[numbers.Number] = None, max_size: Optional[int] = None, allow_implicit: Optional[bool] = None, intermediate_commit_count: Optional[int] = None, intermediate_commit_size: Optional[int] = None) Optional[Union[Any, python_aioarango.job.AsyncJob[Any], python_aioarango.job.BatchJob[Any]]]

Execute raw Javascript command in transaction.

Parameters
  • command (str) – Javascript command to execute.

  • read ([str] | None) – Names of collections read during transaction. If parameter allow_implicit is set to True, any undeclared read collections are loaded lazily.

  • write ([str] | None) – Names of collections written to during transaction. Transaction fails on undeclared write collections.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • timeout (int | None) – Timeout for waiting on collection locks. If set to 0, ArangoDB server waits indefinitely. If not set, system default value is used.

  • max_size (int | None) – Max transaction size limit in bytes.

  • allow_implicit (bool | None) – If set to True, undeclared read collections are loaded lazily. If set to False, transaction fails on any undeclared collections.

  • intermediate_commit_count (int | None) – Max number of operations after which an intermediate commit is performed automatically.

  • intermediate_commit_size (int | None) – Max size of operations in bytes after which an intermediate commit is performed automatically.

Returns

Return value of command.

Return type

Any

Raises

python_aioarango.exceptions.TransactionExecuteError – If execution fails.

property foxx: python_aioarango.foxx.Foxx

Return Foxx API wrapper.

Returns

Foxx API wrapper.

Return type

python_aioarango.foxx.Foxx

graph(name: str) python_aioarango.graph.Graph

Return the graph API wrapper.

Parameters

name (str) – Graph name.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

async graphs() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

List all graphs in the database.

Returns

Graphs in the database.

Return type

[dict]

Raises

python_aioarango.exceptions.GraphListError – If retrieval fails.

async has_collection(name)

Check if collection exists in the database.

Parameters

name (str) – Collection name.

Returns

True if collection exists, False otherwise.

Return type

bool

async has_database(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a database exists.

Parameters

name (str) – Database name.

Returns

True if database exists, False otherwise.

Return type

bool

async has_document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a document exists.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

True if document exists, False otherwise.

Return type

bool

Raises
async has_graph(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a graph exists in the database.

Parameters

name (str | unicode) – Graph name.

Returns

True if graph exists, False otherwise.

Return type

bool

async has_user(username: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if user exists.

Parameters

username (str) – Username.

Returns

True if user exists, False otherwise.

Return type

bool

async insert_document(collection: str, document: Dict[str, Any], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False, overwrite_mode: Optional[str] = None, keep_none: Optional[bool] = None, merge: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Insert a new document.

Parameters
  • collection (str) – Collection name.

  • document (dict) – Document to insert. If it contains the “_key” or “_id” field, the value is used as the key of the new document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate key and the existing document is replaced.

  • return_old (bool) – Include body of the old document if replaced. Applies only when value of overwrite is set to True.

  • overwrite_mode (str | None) – Overwrite behavior used when the document key exists already. Allowed values are “replace” (replace-insert) or “update” (update-insert). Implicitly sets the value of parameter overwrite.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely. Applies only when overwrite_mode is set to “update” (update-insert).

  • merge (bool | None) – If set to True (default), sub-dictionaries are merged instead of the new one overwriting the old one. Applies only when overwrite_mode is set to “update” (update-insert).

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return information on currently loaded JWT secrets.

Returns

Information on currently loaded JWT secrets.

Return type

dict

async log_levels() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return current logging levels.

Returns

Current logging levels.

Return type

dict

async metrics() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server metrics in Prometheus format.

Returns

Server metrics in Prometheus format.

Return type

str

property name: str

Return database name.

Returns

Database name.

Return type

str

async permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

Permission for given database or collection.

Return type

str

Raises

python_aioarango.exceptions.PermissionGetError – If retrieval fails.

async permissions(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user permissions for all databases and collections.

Parameters

username (str) – Username.

Returns

User permissions for all databases and collections.

Return type

dict

Raises

python_aioarango.exceptions.PermissionListError – If retrieval fails.

property pregel: python_aioarango.pregel.Pregel

Return Pregel API wrapper.

Returns

Pregel API wrapper.

Return type

python_aioarango.pregel.Pregel

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return database properties.

Returns

Database properties.

Return type

dict

Raises

python_aioarango.exceptions.DatabasePropertiesError – If retrieval fails.

async read_log(upto: Optional[Union[int, str]] = None, level: Optional[Union[int, str]] = None, start: Optional[int] = None, size: Optional[int] = None, offset: Optional[int] = None, search: Optional[str] = None, sort: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Read the global log from server.

Parameters
  • upto (int | str) – Return the log entries up to the given level (mutually exclusive with parameter level). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • level (int | str) – Return the log entries of only the given level (mutually exclusive with upto). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • start (int) – Return the log entries whose ID is greater or equal to the given value.

  • size (int) – Restrict the size of the result to the given value. This can be used for pagination.

  • offset (int) – Number of entries to skip (e.g. for pagination).

  • search (str) – Return only the log entries containing the given text.

  • sort (str) – Sort the log entries according to the given fashion, which can be “sort” or “desc”.

Returns

Server log entries.

Return type

dict

Raises

python_aioarango.exceptions.ServerReadLogError – If read fails.

async reload_jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Hot-reload JWT secrets.

Calling this without payload reloads JWT secrets from disk. Only files specified via arangod startup option --server.jwt-secret-keyfile or --server.jwt-secret-folder are used. It is not possible to change the location where files are loaded from without restarting the server.

Returns

Information on reloaded JWT secrets.

Return type

dict

async reload_routing() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reload the routing information.

Returns

True if routing was reloaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerReloadRoutingError – If reload fails.

async reload_tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Reload TLS data (server key, client-auth CA).

Returns

New TLS data.

Return type

dict

async rename_view(name: str, new_name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Rename a view.

Parameters
  • name (str) – View name.

  • new_name (str) – New view name.

Returns

True if view was renamed successfully.

Return type

bool

Raises

python_aioarango.exceptions.ViewRenameError – If delete fails.

async replace_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

async replace_document(document: Dict[str, Any], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Replace a document.

Parameters
  • document (dict) – New document to replace the old one with. It must contain the “_id” field. Edge document must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace_user(username: str, password: str, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a user.

Parameters
  • username (str) – Username.

  • password (str) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserReplaceError – If replace fails.

async replace_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

property replication: python_aioarango.replication.Replication

Return Replication API wrapper.

Returns

Replication API wrapper.

Return type

python_aioarango.replication.Replication

async required_db_version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return required version of target database.

Returns

Required version of target database.

Return type

str

Raises

python_aioarango.exceptions.ServerRequiredDBVersionError – If retrieval fails.

async reset_permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reset user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str) – Collection name.

Returns

True if permission was reset successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionRestError – If reset fails.

async role() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server role.

Returns

Server role. Possible values are “SINGLE” (server which is not in a cluster), “COORDINATOR” (cluster coordinator), “PRIMARY”, “SECONDARY”, “AGENT” (Agency node in a cluster) or “UNDEFINED”.

Return type

str

Raises

python_aioarango.exceptions.ServerRoleError – If retrieval fails.

async run_tests(tests: Sequence[str]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Run available unittests on the server.

Parameters

tests ([str]) – List of files containing the test suites.

Returns

Test results.

Return type

dict

Raises

python_aioarango.exceptions.ServerRunTestsError – If execution fails.

async set_log_levels(**kwargs: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Set the logging levels.

This method takes arbitrary keyword arguments where the keys are the logger names and the values are the logging levels. For example:

python_aioarango.set_log_levels(
    agency='DEBUG',
    collector='INFO',
    threads='WARNING'
)

Keys that are not valid logger names are ignored.

Returns

New logging levels.

Return type

dict

async shutdown() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Initiate server shutdown sequence.

Returns

True if the server was shutdown successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerShutdownError – If shutdown fails.

async statistics(description: bool = False) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return server statistics.

Returns

Server statistics.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatisticsError – If retrieval fails.

async status() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server status.

Returns

Server status.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatusError – If retrieval fails.

async task(task_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the details of an active server task.

Parameters

task_id (str) – Server task ID.

Returns

Server task details.

Return type

dict

Raises

python_aioarango.exceptions.TaskGetError – If retrieval fails.

async tasks() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all currently active server tasks.

Returns

Currently active server tasks.

Return type

[dict]

Raises

python_aioarango.exceptions.TaskListError – If retrieval fails.

async time() Optional[Union[datetime.datetime, python_aioarango.job.AsyncJob[datetime.datetime], python_aioarango.job.BatchJob[datetime.datetime]]]

Return server system time.

Returns

Server system time.

Return type

datetime.datetime

Raises

python_aioarango.exceptions.ServerTimeError – If retrieval fails.

async tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return TLS data (server key, client-auth CA).

Returns

TLS data.

Return type

dict

async update_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async update_document(document: Dict[str, Any], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Update a document.

Parameters
  • document (dict) – Partial or full document with the updated values. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new one overwriting the old one.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async update_permission(username: str, permission: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Update user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • permission (str) – Allowed values are “rw” (read and write), “ro” (read only) or “none” (no access).

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

True if access was granted successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionUpdateError – If update fails.

async update_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a user.

Parameters
  • username (str) – Username.

  • password (str | None) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserUpdateError – If update fails.

async update_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async user(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user details.

Parameters

username (str) – Username.

Returns

User details.

Return type

dict

Raises

python_aioarango.exceptions.UserGetError – If retrieval fails.

property username: Optional[str]

Return the username.

Returns

Username.

Return type

str

async users() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all user details.

Returns

List of user details.

Return type

[dict]

Raises

python_aioarango.exceptions.UserListError – If retrieval fails.

async version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return ArangoDB server version.

Returns

Server version.

Return type

str

Raises

python_aioarango.exceptions.ServerVersionError – If retrieval fails.

async view(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return view details.

Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewGetError – If retrieval fails.

async views() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of views and their summaries.

Returns

List of views.

Return type

[dict]

Raises

python_aioarango.exceptions.ViewListError – If retrieval fails.

property wal: python_aioarango.wal.WAL

Return WAL (Write-Ahead Log) API wrapper.

Returns

WAL API wrapper.

Return type

python_aioarango.wal.WAL

TransactionDatabase

class python_aioarango.database.TransactionDatabase(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection])[source]

Database API wrapper tailored specifically for transactions.

See python_aioarango.database.StandardDatabase.begin_transaction().

Parameters

connection – HTTP connection.

async begin_transaction(read: Optional[Union[str, Sequence[str]]] = None, write: Optional[Union[str, Sequence[str]]] = None, exclusive: Optional[Union[str, Sequence[str]]] = None, sync: Optional[bool] = None, allow_implicit: Optional[bool] = None, lock_timeout: Optional[int] = None, max_size: Optional[int] = None)[source]

Begin the transaction.

Parameters
  • read (str | [str] | None) – Name(s) of collections read during transaction. Read-only collections are added lazily but should be declared if possible to avoid deadlocks.

  • write (str | [str] | None) – Name(s) of collections written to during transaction with shared access.

  • exclusive (str | [str] | None) – Name(s) of collections written to during transaction with exclusive access.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • allow_implicit (bool | None) – Allow reading from undeclared collections.

  • lock_timeout (int | None) – Timeout for waiting on collection locks. If not given, a default value is used. Setting it to 0 disables the timeout.

  • max_size (int | None) – Max transaction size in bytes.

property transaction_id: str

Return the transaction ID.

Returns

Transaction ID.

Return type

str

async transaction_status() str[source]

Return the transaction status.

Returns

Transaction status.

Return type

str

Raises

python_aioarango.exceptions.TransactionStatusError – If retrieval fails.

async commit_transaction() bool[source]

Commit the transaction.

Returns

True if commit was successful.

Return type

bool

Raises

python_aioarango.exceptions.TransactionCommitError – If commit fails.

async abort_transaction() bool[source]

Abort the transaction.

Returns

True if the abort operation was successful.

Return type

bool

Raises

python_aioarango.exceptions.TransactionAbortError – If abort fails.

async analyzer(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return analyzer details.

Parameters

name (str) – Analyzer name.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerGetError – If retrieval fails.

async analyzers() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of analyzers.

Returns

List of analyzers.

Return type

[dict]

Raises

python_aioarango.exceptions.AnalyzerListError – If retrieval fails.

property aql: python_aioarango.aql.AQL

Return AQL (ArangoDB Query Language) API wrapper.

Returns

AQL API wrapper.

Return type

python_aioarango.aql.AQL

async async_jobs(status: str, count: Optional[int] = None) Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return IDs of async jobs with given status.

Parameters
  • status (str) – Job status (e.g. “pending”, “done”).

  • count (int) – Max number of job IDs to return.

Returns

List of job IDs.

Return type

[str]

Raises

python_aioarango.exceptions.AsyncJobListError – If retrieval fails.

property backup: python_aioarango.backup.Backup

Return Backup API wrapper.

Returns

Backup API wrapper.

Return type

python_aioarango.backup.Backup

async clear_async_jobs(threshold: Optional[int] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Clear async job results from the server.

Async jobs that are still queued or running are not stopped.

Parameters

threshold (int | None) – If specified, only the job results created prior to the threshold (a unix timestamp) are deleted. Otherwise, all job results are deleted.

Returns

True if job results were cleared successfully.

Return type

bool

Raises

python_aioarango.exceptions.AsyncJobClearError – If operation fails.

property cluster: python_aioarango.cluster.Cluster

Return Cluster API wrapper.

Returns

Cluster API wrapper.

Return type

python_aioarango.cluster.Cluster

collection(name: str) python_aioarango.collection.StandardCollection

Return the standard collection API wrapper.

Parameters

name (str) – Collection name.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

async collections() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return the collections in the database.

Returns

Collections in the database and their details.

Return type

[dict]

Raises

python_aioarango.exceptions.CollectionListError – If retrieval fails.

property conn: Union[BaseConnection, JwtConnection, JwtSuperuserConnection]

Return the HTTP connection.

Returns

HTTP connection.

Return type

python_aioarango.connection.BasicConnection | python_aioarango.connection.JwtConnection | python_aioarango.connection.JwtSuperuserConnection

property context: str

Return the API execution context.

Returns

API execution context. Possible values are “default”, “async”, “batch” and “transaction”.

Return type

str

async create_analyzer(name: str, analyzer_type: str, properties: Optional[Dict[str, Any]] = None, features: Optional[Sequence[str]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an analyzer.

Parameters
  • name (str) – Analyzer name.

  • analyzer_type (str) – Analyzer type.

  • properties (dict | None) – Analyzer properties.

  • features (list | None) – Analyzer features.

Returns

Analyzer details.

Return type

dict

Raises

python_aioarango.exceptions.AnalyzerCreateError – If create fails.

async create_arangosearch_view(name: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async create_collection(name: str, sync: bool = False, system: bool = False, edge: bool = False, user_keys: bool = True, key_increment: Optional[int] = None, key_offset: Optional[int] = None, key_generator: str = 'traditional', shard_fields: Optional[Sequence[str]] = None, shard_count: Optional[int] = None, replication_factor: Optional[int] = None, shard_like: Optional[str] = None, sync_replication: Optional[bool] = None, enforce_replication_factor: Optional[bool] = None, sharding_strategy: Optional[str] = None, smart_join_attribute: Optional[str] = None, write_concern: Optional[int] = None, schema: Optional[Dict[str, Any]] = None) Optional[Union[python_aioarango.collection.StandardCollection, python_aioarango.job.AsyncJob[python_aioarango.collection.StandardCollection], python_aioarango.job.BatchJob[python_aioarango.collection.StandardCollection]]]

Create a new collection.

Parameters
  • name (str) – Collection name.

  • sync (bool | None) – If set to True, document operations via the collection will block until synchronized to disk by default.

  • system (bool) – If set to True, a system collection is created. The collection name must have leading underscore “_” character.

  • edge (bool) – If set to True, an edge collection is created.

  • key_generator (str) – Used for generating document keys. Allowed values are “traditional” or “autoincrement”.

  • user_keys (bool) – If set to True, users are allowed to supply document keys. If set to False, the key generator is solely responsible for supplying the key values.

  • key_increment (int) – Key increment value. Applies only when value of key_generator is set to “autoincrement”.

  • key_offset (int) – Key offset value. Applies only when value of key_generator is set to “autoincrement”.

  • shard_fields ([str]) – Field(s) used to determine the target shard.

  • shard_count (int) – Number of shards to create.

  • replication_factor (int) – Number of copies of each shard on different servers in a cluster. Allowed values are 1 (only one copy is kept and no synchronous replication), and n (n-1 replicas are kept and any two copies are replicated across servers synchronously, meaning every write to the master is copied to all slaves before operation is reported successful).

  • shard_like (str) – Name of prototype collection whose sharding specifics are imitated. Prototype collections cannot be dropped before imitating collections. Applies to enterprise version of ArangoDB only.

  • sync_replication (bool) – If set to True, server reports success only when collection is created in all replicas. You can set this to False for faster server response, and if full replication is not a concern.

  • enforce_replication_factor (bool) – Check if there are enough replicas available at creation time, or halt the operation.

  • sharding_strategy (str) – Sharding strategy. Available for ArangoDB version and up only. Possible values are “community-compat”, “enterprise-compat”, “enterprise-smart-edge-compat”, “hash” and “enterprise-hash-smart-edge”. Refer to ArangoDB documentation for more details on each value.

  • smart_join_attribute (str) – Attribute of the collection which must contain the shard key value of the smart join collection. The shard key for the documents must contain the value of this attribute, followed by a colon “:” and the primary key of the document. Requires parameter shard_like to be set to the name of another collection, and parameter shard_fields to be set to a single shard key attribute, with another colon “:” at the end. Available only for enterprise version of ArangoDB.

  • write_concern (int) – Write concern for the collection. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time. The value of this parameter cannot be larger than that of replication_factor. Default value is 1. Used for clusters only.

  • schema (dict) – Optional dict specifying the collection level schema for documents. See ArangoDB documentation for more information on document schema validation.

Returns

Standard collection API wrapper.

Return type

python_aioarango.collection.StandardCollection

Raises

python_aioarango.exceptions.CollectionCreateError – If create fails.

async create_database(name: str, users: Optional[Sequence[Dict[str, Any]]] = None, replication_factor: Optional[Union[int, str]] = None, write_concern: Optional[int] = None, sharding: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Create a new database.

Parameters
  • name (str) – Database name.

  • users ([dict]) – List of users with access to the new database, where each user is a dictionary with fields “username”, “password”, “active” and “extra” (see below for example). If not set, only the admin and current user are granted access.

  • replication_factor (int | str) – Default replication factor for collections created in this database. Special values include “satellite” which replicates the collection to every DBServer, and 1 which disables replication. Used for clusters only.

  • write_concern (int) – Default write concern for collections created in this database. Determines how many copies of each shard are required to be in sync on different DBServers. If there are less than these many copies in the cluster a shard will refuse to write. Writes to shards with enough up-to-date copies will succeed at the same time, however. Value of this parameter can not be larger than the value of replication_factor. Used for clusters only.

  • sharding (str) – Sharding method used for new collections in this database. Allowed values are: “”, “flexible” and “single”. The first two are equivalent. Used for clusters only.

Returns

True if database was created successfully.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseCreateError – If create fails.

Here is an example entry for parameter users:

{
    'username': 'john',
    'password': 'password',
    'active': True,
    'extra': {'Department': 'IT'}
}
async create_graph(name: str, edge_definitions: Optional[Sequence[Dict[str, Any]]] = None, orphan_collections: Optional[Sequence[str]] = None, smart: Optional[bool] = None, smart_field: Optional[str] = None, shard_count: Optional[int] = None) Optional[Union[python_aioarango.graph.Graph, python_aioarango.job.AsyncJob[python_aioarango.graph.Graph], python_aioarango.job.BatchJob[python_aioarango.graph.Graph]]]

Create a new graph.

Parameters
  • name (str) – Graph name.

  • edge_definitions ([dict] | None) – List of edge definitions, where each edge definition entry is a dictionary with fields “edge_collection”, “from_vertex_collections” and “to_vertex_collections” (see below for example).

  • orphan_collections ([str] | None) – Names of additional vertex collections that are not in edge definitions.

  • smart (bool | None) – If set to True, sharding is enabled (see parameter smart_field below). Applies only to enterprise version of ArangoDB.

  • smart_field (str | None) – Document field used to shard the vertices of the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. Applies only to enterprise version of ArangoDB.

  • shard_count (int | None) – Number of shards used for every collection in the graph. To use this, parameter smart must be set to True and every vertex in the graph must have the smart field. This number cannot be modified later once set. Applies only to enterprise version of ArangoDB.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

Raises

python_aioarango.exceptions.GraphCreateError – If create fails.

Here is an example entry for parameter edge_definitions:

{
    'edge_collection': 'teach',
    'from_vertex_collections': ['teachers'],
    'to_vertex_collections': ['lectures']
}
async create_task(name: str, command: str, params: Optional[Dict[str, Any]] = None, period: Optional[int] = None, offset: Optional[int] = None, task_id: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new server task.

Parameters
  • name (str) – Name of the server task.

  • command (str) – Javascript command to execute.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • period (int | None) – Number of seconds to wait between executions. If set to 0, the new task will be “timed”, meaning it will execute only once and be deleted afterwards.

  • offset (int | None) – Initial delay before execution in seconds.

  • task_id (str | None) – Pre-defined ID for the new server task.

Returns

Details of the new task.

Return type

dict

Raises

python_aioarango.exceptions.TaskCreateError – If create fails.

async create_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a new user.

Parameters
  • username (str) – Username.

  • password (str | None) – Password.

  • active (bool | None) – True if user is active, False otherwise.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserCreateError – If create fails.

async create_view(name: str, view_type: str, properties: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Create a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewCreateError – If create fails.

async databases() Optional[Union[List[str], python_aioarango.job.AsyncJob[List[str]], python_aioarango.job.BatchJob[List[str]]]]

Return the names all databases.

Returns

Database names.

Return type

[str]

Raises

python_aioarango.exceptions.DatabaseListError – If retrieval fails.

property db_name: str

Return the name of the current database.

Returns

Database name.

Return type

str

async delete_analyzer(name: str, force: bool = False, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete an analyzer.

Parameters
  • name (str) – Analyzer name.

  • force (bool) – Remove the analyzer configuration even if in use.

  • ignore_missing (bool) – Do not raise an exception on missing analyzer.

Returns

True if analyzer was deleted successfully, False if analyzer was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.AnalyzerDeleteError – If delete fails.

async delete_collection(name: str, ignore_missing: bool = False, system: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the collection.

Parameters
  • name (str) – Collection name.

  • ignore_missing (bool) – Do not raise an exception on missing collection.

  • system (bool) – Whether the collection is a system collection.

Returns

True if collection was deleted successfully, False if collection was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.CollectionDeleteError – If delete fails.

async delete_database(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete the database.

Parameters
  • name (str) – Database name.

  • ignore_missing (bool) – Do not raise an exception on missing database.

Returns

True if database was deleted successfully, False if database was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.DatabaseDeleteError – If delete fails.

async delete_document(document: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Delete a document.

Parameters
  • document (str | dict) – Document ID, key or body. Document body must contain the “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision), or True if parameter silent was set to True, or False if document was not found and ignore_missing was set to True (does not apply in transactions).

Return type

bool | dict

Raises
async delete_graph(name: str, ignore_missing: bool = False, drop_collections: Optional[bool] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Drop the graph of the given name from the database.

Parameters
  • name (str) – Graph name.

  • ignore_missing (bool) – Do not raise an exception on missing graph.

  • drop_collections (bool | None) – Drop the collections of the graph also. This is only if they are not in use by other graphs.

Returns

True if graph was deleted successfully, False if graph was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.GraphDeleteError – If delete fails.

async delete_task(task_id: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a server task.

Parameters
  • task_id (str) – Server task ID.

  • ignore_missing (bool) – Do not raise an exception on missing task.

Returns

True if task was successfully deleted, False if task was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.TaskDeleteError – If delete fails.

async delete_user(username: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a user.

Parameters
  • username (str) – Username.

  • ignore_missing (bool) – Do not raise an exception on missing user.

Returns

True if user was deleted successfully, False if user was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.UserDeleteError – If delete fails.

async delete_view(name: str, ignore_missing: bool = False) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Delete a view.

Parameters
  • name (str) – View name.

  • ignore_missing (bool) – Do not raise an exception on missing view.

Returns

True if view was deleted successfully, False if view was not found and ignore_missing was set to True.

Return type

bool

Raises

python_aioarango.exceptions.ViewDeleteError – If delete fails.

async details() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server details.

Returns

Server details.

Return type

dict

Raises

python_aioarango.exceptions.ServerDetailsError – If retrieval fails.

async document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]]

Return a document.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

Document, or None if not found.

Return type

dict | None

Raises
async echo() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return details of the last request (e.g. headers, payload).

Returns

Details of the last request.

Return type

dict

Raises

python_aioarango.exceptions.ServerEchoError – If retrieval fails.

async encryption() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Rotate the user-supplied keys for encryption.

This method is available only for enterprise edition of ArangoDB.

Returns

New TLS data.

Return type

dict

Raises

python_aioarango.exceptions.ServerEncryptionError – If retrieval fails.

async engine() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the database engine details.

Returns

Database engine details.

Return type

dict

Raises

python_aioarango.exceptions.ServerEngineError – If retrieval fails.

async execute_transaction(command: str, params: Optional[Dict[str, Any]] = None, read: Optional[Sequence[str]] = None, write: Optional[Sequence[str]] = None, sync: Optional[bool] = None, timeout: Optional[numbers.Number] = None, max_size: Optional[int] = None, allow_implicit: Optional[bool] = None, intermediate_commit_count: Optional[int] = None, intermediate_commit_size: Optional[int] = None) Optional[Union[Any, python_aioarango.job.AsyncJob[Any], python_aioarango.job.BatchJob[Any]]]

Execute raw Javascript command in transaction.

Parameters
  • command (str) – Javascript command to execute.

  • read ([str] | None) – Names of collections read during transaction. If parameter allow_implicit is set to True, any undeclared read collections are loaded lazily.

  • write ([str] | None) – Names of collections written to during transaction. Transaction fails on undeclared write collections.

  • params (dict | None) – Optional parameters passed into the Javascript command.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • timeout (int | None) – Timeout for waiting on collection locks. If set to 0, ArangoDB server waits indefinitely. If not set, system default value is used.

  • max_size (int | None) – Max transaction size limit in bytes.

  • allow_implicit (bool | None) – If set to True, undeclared read collections are loaded lazily. If set to False, transaction fails on any undeclared collections.

  • intermediate_commit_count (int | None) – Max number of operations after which an intermediate commit is performed automatically.

  • intermediate_commit_size (int | None) – Max size of operations in bytes after which an intermediate commit is performed automatically.

Returns

Return value of command.

Return type

Any

Raises

python_aioarango.exceptions.TransactionExecuteError – If execution fails.

property foxx: python_aioarango.foxx.Foxx

Return Foxx API wrapper.

Returns

Foxx API wrapper.

Return type

python_aioarango.foxx.Foxx

graph(name: str) python_aioarango.graph.Graph

Return the graph API wrapper.

Parameters

name (str) – Graph name.

Returns

Graph API wrapper.

Return type

python_aioarango.graph.Graph

async graphs() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

List all graphs in the database.

Returns

Graphs in the database.

Return type

[dict]

Raises

python_aioarango.exceptions.GraphListError – If retrieval fails.

async has_collection(name)

Check if collection exists in the database.

Parameters

name (str) – Collection name.

Returns

True if collection exists, False otherwise.

Return type

bool

async has_database(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a database exists.

Parameters

name (str) – Database name.

Returns

True if database exists, False otherwise.

Return type

bool

async has_document(document: Dict[str, Any], rev: Optional[str] = None, check_rev: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a document exists.

Parameters
  • document (str | dict) – Document ID or body with “_id” field.

  • rev (str | None) – Expected document revision. Overrides value of “_rev” field in document if present.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

Returns

True if document exists, False otherwise.

Return type

bool

Raises
async has_graph(name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if a graph exists in the database.

Parameters

name (str | unicode) – Graph name.

Returns

True if graph exists, False otherwise.

Return type

bool

async has_user(username: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Check if user exists.

Parameters

username (str) – Username.

Returns

True if user exists, False otherwise.

Return type

bool

async insert_document(collection: str, document: Dict[str, Any], return_new: bool = False, sync: Optional[bool] = None, silent: bool = False, overwrite: bool = False, return_old: bool = False, overwrite_mode: Optional[str] = None, keep_none: Optional[bool] = None, merge: Optional[bool] = None) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Insert a new document.

Parameters
  • collection (str) – Collection name.

  • document (dict) – Document to insert. If it contains the “_key” or “_id” field, the value is used as the key of the new document (otherwise it is auto-generated). Any “_rev” field is ignored.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • overwrite (bool) – If set to True, operation does not fail on duplicate key and the existing document is replaced.

  • return_old (bool) – Include body of the old document if replaced. Applies only when value of overwrite is set to True.

  • overwrite_mode (str | None) – Overwrite behavior used when the document key exists already. Allowed values are “replace” (replace-insert) or “update” (update-insert). Implicitly sets the value of parameter overwrite.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely. Applies only when overwrite_mode is set to “update” (update-insert).

  • merge (bool | None) – If set to True (default), sub-dictionaries are merged instead of the new one overwriting the old one. Applies only when overwrite_mode is set to “update” (update-insert).

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return information on currently loaded JWT secrets.

Returns

Information on currently loaded JWT secrets.

Return type

dict

async log_levels() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return current logging levels.

Returns

Current logging levels.

Return type

dict

async metrics() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server metrics in Prometheus format.

Returns

Server metrics in Prometheus format.

Return type

str

property name: str

Return database name.

Returns

Database name.

Return type

str

async permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

Permission for given database or collection.

Return type

str

Raises

python_aioarango.exceptions.PermissionGetError – If retrieval fails.

async permissions(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user permissions for all databases and collections.

Parameters

username (str) – Username.

Returns

User permissions for all databases and collections.

Return type

dict

Raises

python_aioarango.exceptions.PermissionListError – If retrieval fails.

property pregel: python_aioarango.pregel.Pregel

Return Pregel API wrapper.

Returns

Pregel API wrapper.

Return type

python_aioarango.pregel.Pregel

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return database properties.

Returns

Database properties.

Return type

dict

Raises

python_aioarango.exceptions.DatabasePropertiesError – If retrieval fails.

async read_log(upto: Optional[Union[int, str]] = None, level: Optional[Union[int, str]] = None, start: Optional[int] = None, size: Optional[int] = None, offset: Optional[int] = None, search: Optional[str] = None, sort: Optional[str] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Read the global log from server.

Parameters
  • upto (int | str) – Return the log entries up to the given level (mutually exclusive with parameter level). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • level (int | str) – Return the log entries of only the given level (mutually exclusive with upto). Allowed values are “fatal”, “error”, “warning”, “info” (default) and “debug”.

  • start (int) – Return the log entries whose ID is greater or equal to the given value.

  • size (int) – Restrict the size of the result to the given value. This can be used for pagination.

  • offset (int) – Number of entries to skip (e.g. for pagination).

  • search (str) – Return only the log entries containing the given text.

  • sort (str) – Sort the log entries according to the given fashion, which can be “sort” or “desc”.

Returns

Server log entries.

Return type

dict

Raises

python_aioarango.exceptions.ServerReadLogError – If read fails.

async reload_jwt_secrets() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Hot-reload JWT secrets.

Calling this without payload reloads JWT secrets from disk. Only files specified via arangod startup option --server.jwt-secret-keyfile or --server.jwt-secret-folder are used. It is not possible to change the location where files are loaded from without restarting the server.

Returns

Information on reloaded JWT secrets.

Return type

dict

async reload_routing() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reload the routing information.

Returns

True if routing was reloaded successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerReloadRoutingError – If reload fails.

async reload_tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Reload TLS data (server key, client-auth CA).

Returns

New TLS data.

Return type

dict

async rename_view(name: str, new_name: str) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Rename a view.

Parameters
  • name (str) – View name.

  • new_name (str) – New view name.

Returns

True if view was renamed successfully.

Return type

bool

Raises

python_aioarango.exceptions.ViewRenameError – If delete fails.

async replace_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

async replace_document(document: Dict[str, Any], check_rev: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Replace a document.

Parameters
  • document (dict) – New document to replace the old one with. It must contain the “_id” field. Edge document must also have “_from” and “_to” fields.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace_user(username: str, password: str, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a user.

Parameters
  • username (str) – Username.

  • password (str) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserReplaceError – If replace fails.

async replace_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Replace a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewReplaceError – If replace fails.

property replication: python_aioarango.replication.Replication

Return Replication API wrapper.

Returns

Replication API wrapper.

Return type

python_aioarango.replication.Replication

async required_db_version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return required version of target database.

Returns

Required version of target database.

Return type

str

Raises

python_aioarango.exceptions.ServerRequiredDBVersionError – If retrieval fails.

async reset_permission(username: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Reset user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • database (str) – Database name.

  • collection (str) – Collection name.

Returns

True if permission was reset successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionRestError – If reset fails.

async role() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return server role.

Returns

Server role. Possible values are “SINGLE” (server which is not in a cluster), “COORDINATOR” (cluster coordinator), “PRIMARY”, “SECONDARY”, “AGENT” (Agency node in a cluster) or “UNDEFINED”.

Return type

str

Raises

python_aioarango.exceptions.ServerRoleError – If retrieval fails.

async run_tests(tests: Sequence[str]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Run available unittests on the server.

Parameters

tests ([str]) – List of files containing the test suites.

Returns

Test results.

Return type

dict

Raises

python_aioarango.exceptions.ServerRunTestsError – If execution fails.

async set_log_levels(**kwargs: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Set the logging levels.

This method takes arbitrary keyword arguments where the keys are the logger names and the values are the logging levels. For example:

python_aioarango.set_log_levels(
    agency='DEBUG',
    collector='INFO',
    threads='WARNING'
)

Keys that are not valid logger names are ignored.

Returns

New logging levels.

Return type

dict

async shutdown() Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Initiate server shutdown sequence.

Returns

True if the server was shutdown successfully.

Return type

bool

Raises

python_aioarango.exceptions.ServerShutdownError – If shutdown fails.

async statistics(description: bool = False) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return server statistics.

Returns

Server statistics.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatisticsError – If retrieval fails.

async status() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return ArangoDB server status.

Returns

Server status.

Return type

dict

Raises

python_aioarango.exceptions.ServerStatusError – If retrieval fails.

async task(task_id: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return the details of an active server task.

Parameters

task_id (str) – Server task ID.

Returns

Server task details.

Return type

dict

Raises

python_aioarango.exceptions.TaskGetError – If retrieval fails.

async tasks() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all currently active server tasks.

Returns

Currently active server tasks.

Return type

[dict]

Raises

python_aioarango.exceptions.TaskListError – If retrieval fails.

async time() Optional[Union[datetime.datetime, python_aioarango.job.AsyncJob[datetime.datetime], python_aioarango.job.BatchJob[datetime.datetime]]]

Return server system time.

Returns

Server system time.

Return type

datetime.datetime

Raises

python_aioarango.exceptions.ServerTimeError – If retrieval fails.

async tls() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return TLS data (server key, client-auth CA).

Returns

TLS data.

Return type

dict

async update_arangosearch_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update an ArangoSearch view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async update_document(document: Dict[str, Any], check_rev: bool = True, merge: bool = True, keep_none: bool = True, return_new: bool = False, return_old: bool = False, sync: Optional[bool] = None, silent: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]]

Update a document.

Parameters
  • document (dict) – Partial or full document with the updated values. It must contain the “_id” field.

  • check_rev (bool) – If set to True, revision of document (if given) is compared against the revision of target document.

  • merge (bool | None) – If set to True, sub-dictionaries are merged instead of the new one overwriting the old one.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. Otherwise, they are removed completely.

  • return_new (bool) – Include body of the new document in the result.

  • return_old (bool) – Include body of the old document in the result.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async update_permission(username: str, permission: str, database: str, collection: Optional[str] = None) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]]

Update user permission for a specific database or collection.

Parameters
  • username (str) – Username.

  • permission (str) – Allowed values are “rw” (read and write), “ro” (read only) or “none” (no access).

  • database (str) – Database name.

  • collection (str | None) – Collection name.

Returns

True if access was granted successfully.

Return type

bool

Raises

python_aioarango.exceptions.PermissionUpdateError – If update fails.

async update_user(username: str, password: Optional[str] = None, active: Optional[bool] = None, extra: Optional[Dict[str, Any]] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a user.

Parameters
  • username (str) – Username.

  • password (str | None) – New password.

  • active (bool | None) – Whether the user is active.

  • extra (dict | None) – Additional data for the user.

Returns

New user details.

Return type

dict

Raises

python_aioarango.exceptions.UserUpdateError – If update fails.

async update_view(name: str, properties: Dict[str, Any]) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Update a view.

Parameters
Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewUpdateError – If update fails.

async user(username: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return user details.

Parameters

username (str) – Username.

Returns

User details.

Return type

dict

Raises

python_aioarango.exceptions.UserGetError – If retrieval fails.

property username: Optional[str]

Return the username.

Returns

Username.

Return type

str

async users() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return all user details.

Returns

List of user details.

Return type

[dict]

Raises

python_aioarango.exceptions.UserListError – If retrieval fails.

async version() Optional[Union[str, python_aioarango.job.AsyncJob[str], python_aioarango.job.BatchJob[str]]]

Return ArangoDB server version.

Returns

Server version.

Return type

str

Raises

python_aioarango.exceptions.ServerVersionError – If retrieval fails.

async view(name: str) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]]

Return view details.

Returns

View details.

Return type

dict

Raises

python_aioarango.exceptions.ViewGetError – If retrieval fails.

async views() Optional[Union[List[Dict[str, Any]], python_aioarango.job.AsyncJob[List[Dict[str, Any]]], python_aioarango.job.BatchJob[List[Dict[str, Any]]]]]

Return list of views and their summaries.

Returns

List of views.

Return type

[dict]

Raises

python_aioarango.exceptions.ViewListError – If retrieval fails.

property wal: python_aioarango.wal.WAL

Return WAL (Write-Ahead Log) API wrapper.

Returns

WAL API wrapper.

Return type

python_aioarango.wal.WAL

VertexCollection

class python_aioarango.collection.VertexCollection(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor], graph: str, name: str)[source]

Vertex collection API wrapper.

Parameters
  • connection – HTTP connection.

  • executor – API executor.

  • graph – Graph name.

  • name – Vertex collection name.

property graph: str

Return the graph name.

Returns

Graph name.

Return type

str

async get(vertex: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True) Union[Dict[str, Any], None, python_aioarango.job.AsyncJob[Optional[Dict[str, Any]]], python_aioarango.job.BatchJob[Optional[Dict[str, Any]]]][source]

Return a vertex document.

Parameters
  • vertex (str | dict) – Vertex document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in vertex if present.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

Returns

Vertex document or None if not found.

Return type

dict | None

Raises
async insert(vertex: Dict[str, Any], sync: Optional[bool] = None, silent: bool = False, return_new: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Insert a new vertex document.

Parameters
  • vertex (dict) – New vertex document to insert. If it has “_key” or “_id” field, its value is used as key of the new vertex (otherwise it is auto-generated). Any “_rev” field is ignored.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision), or True if parameter silent was set to True.

Return type

bool | dict

Raises

python_aioarango.exceptions.DocumentInsertError – If insert fails.

async update(vertex: Dict[str, Any], check_rev: bool = True, keep_none: bool = True, sync: Optional[bool] = None, silent: bool = False, return_old: bool = False, return_new: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Update a vertex document.

Parameters
  • vertex (dict) – Partial or full vertex document with updated values. It must contain the “_key” or “_id” field.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

  • keep_none (bool | None) – If set to True, fields with value None are retained in the document. If set to False, they are removed completely.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async replace(vertex: Dict[str, Any], check_rev: bool = True, sync: Optional[bool] = None, silent: bool = False, return_old: bool = False, return_new: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Replace a vertex document.

Parameters
  • vertex (dict) – New vertex document to replace the old one with. It must contain the “_key” or “_id” field.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • silent (bool) – If set to True, no document metadata is returned. This can be used to save resources.

  • return_old (bool) – Include body of the old document in the returned metadata. Ignored if parameter silent is set to True.

  • return_new (bool) – Include body of the new document in the returned metadata. Ignored if parameter silent is set to True.

Returns

Document metadata (e.g. document key, revision) or True if parameter silent was set to True.

Return type

bool | dict

Raises
async delete(vertex: Union[str, Dict[str, Any]], rev: Optional[str] = None, check_rev: bool = True, ignore_missing: bool = False, sync: Optional[bool] = None, return_old: bool = False) Optional[Union[bool, Dict[str, Any], python_aioarango.job.AsyncJob[Union[bool, Dict[str, Any]]], python_aioarango.job.BatchJob[Union[bool, Dict[str, Any]]]]][source]

Delete a vertex document. All connected edges are also deleted.

Parameters
  • vertex (str | dict) – Vertex document ID, key or body. Document body must contain the “_id” or “_key” field.

  • rev (str | None) – Expected document revision. Overrides the value of “_rev” field in vertex if present.

  • check_rev (bool) – If set to True, revision of vertex (if given) is compared against the revision of target vertex document.

  • ignore_missing (bool) – Do not raise an exception on missing document. This parameter has no effect in transactions where an exception is always raised on failures.

  • sync (bool | None) – Block until operation is synchronized to disk.

  • return_old (bool) – Return body of the old document in the result.

Returns

True if vertex was deleted successfully, False if vertex was not found and ignore_missing was set to True (does not apply in transactions). Old document is returned if return_old is set to True.

Return type

bool | dict

Raises

WAL

class python_aioarango.wal.WAL(connection: Union[BaseConnection, JwtConnection, JwtSuperuserConnection], executor: Union[DefaultApiExecutor, AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor])[source]

WAL (Write-Ahead Log) API wrapper.

async properties() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return WAL properties.

Returns

WAL properties.

Return type

dict

Raises

python_aioarango.exceptions.WALPropertiesError – If retrieval fails.

async configure(oversized_ops: Optional[bool] = None, log_size: Optional[int] = None, historic_logs: Optional[int] = None, reserve_logs: Optional[int] = None, throttle_wait: Optional[int] = None, throttle_limit: Optional[int] = None) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Configure WAL properties.

Parameters
  • oversized_ops (bool) – If set to True, operations bigger than a single log file are allowed to be executed and stored.

  • log_size (int) – Size of each write-ahead log file in bytes.

  • historic_logs (int) – Max number of historic log files to keep.

  • reserve_logs (int) – Max number of reserve log files to allocate.

  • throttle_wait (int) – Wait time before aborting when write-throttled in milliseconds.

  • throttle_limit (int) – Number of pending garbage collector operations that, when reached, activates write-throttling. Value of 0 means no throttling is triggered.

Returns

New WAL properties.

Return type

dict

Raises

python_aioarango.exceptions.WALConfigureError – If operation fails.

async transactions() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return details on currently running WAL transactions.

Fields in the returned details are as follows:

"last_collected"    : ID of the last collected log file (at the
                      start of each running transaction) or None
                      if no transactions are running.

"last_sealed"       : ID of the last sealed log file (at the start
                      of each running transaction) or None if no
                      transactions are running.

"count"             : Number of currently running transactions.
Returns

Details on currently running WAL transactions.

Return type

dict

Raises

python_aioarango.exceptions.WALTransactionListError – If retrieval fails.

async flush(sync: bool = True, garbage_collect: bool = True) Optional[Union[bool, python_aioarango.job.AsyncJob[bool], python_aioarango.job.BatchJob[bool]]][source]

Synchronize WAL to disk.

Parameters
  • sync (bool | None) – Block until the synchronization is complete.

  • garbage_collect (bool) – Block until flushed data is garbage collected.

Returns

True if WAL was flushed successfully.

Return type

bool

Raises

python_aioarango.exceptions.WALFlushError – If flush operation fails.

async tick_ranges() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the available ranges of tick values for all WAL files.

Returns

Ranges of tick values.

Return type

dict

Raises

python_aioarango.exceptions.WALTickRangesError – If retrieval fails.

async last_tick() Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Return the last available tick value (last successful operation).

Returns

Last tick value in the WAL.

Return type

dict

Raises

python_aioarango.exceptions.WALLastTickError – If retrieval fails.

async tail(lower: Optional[str] = None, upper: Optional[str] = None, last_scanned: Optional[str] = None, all_databases: Optional[bool] = None, chunk_size: Optional[int] = None, syncer_id: Optional[int] = None, server_id: Optional[int] = None, client_info: Optional[str] = None, barrier_id: Optional[int] = None, deserialize: bool = False) Optional[Union[Dict[str, Any], python_aioarango.job.AsyncJob[Dict[str, Any]], python_aioarango.job.BatchJob[Dict[str, Any]]]][source]

Fetch recent WAL operations.

Parameters
  • lower (str | None) – Exclusive lower bound tick value. On successive calls to this method you should set this to the value of “last_included” from previous call (unless the value was 0).

  • upper (str | None) – Inclusive upper bound tick value for results.

  • last_scanned (str | None) – On successive calls to this method you should set this to the value of “last_scanned” from previous call (or 0 on first try). This allows the rocksdb engine to break up large transactions over multiple responses.

  • all_databases (bool | None) – Whether operations for all databases should be included. When set to False only the operations for the current database are included. The value True is only valid on “_system” database. The default is False.

  • chunk_size (int | None) – Approximate maximum size of the returned result.

  • syncer_id (int | None) – ID of the client used to tail results. The server will use this to keep operations until the client has fetched them. Must be a positive integer. Note this or server_id is required to have a chance at fetching reading all operations with the rocksdb storage engine.

  • server_id (int | None) – ID of the client machine. If unset, the server will use this to keep operations until the client has fetched them. Must be a positive integer. Note this or syncer_id is required to have a chance at fetching reading all operations with the rocksdb storage engine.

  • client_info (str | None) – Short description of the client, used for informative purposes only.

  • barrier_id (int | None) – ID of barrier used to keep WAL entries around.

  • deserialize (bool) – Deserialize the response content. Default is False.

Returns

If deserialize is set to False, content is returned raw as a string. If deserialize is set to True, it is deserialized and returned as a list of dictionaries.

Return type

dict

Raises

python_aioarango.exceptions.WALTailError – If tail operation fails.