Welcome to pyArango’s documentation!

https://travis-ci.org/tariqdaouda/pyArango.svg?branch=1.2.2 https://img.shields.io/badge/python-2.7%2C%203.5-blue.svghttps://img.shields.io/badge/arangodb-3.6-blue.svg

pyArango is a python driver for the NoSQL amazing database ArangoDB first written by Tariq Daouda. As of January 2019 pyArango was handed over to the ArangoDB-Community that now ensures the developement and maintenance. It has a very light interface and built in validation. pyArango is distributed under the ApacheV2 Licence and the full source code can be found on github.

Key Features

pyArango is geared toward the developer. It’s here to help to you develop really cool apps using ArangoDB, really fast.

  • Light and Simple interface
  • Built-in Validation of fields on setting or on saving
  • Support for all index types
  • Supports graphs, traversals and all types of queries
  • Caching of documents with Insertions and Lookups in O(1)

Collections are treated as types that apply to the documents within. That means that you can define a Collection and then create instances of this Collection in several databases. The same goes for graphs

In other words, you can have two databases cache_db and real_db each of them with an instance of a Users Collection. You can then be assured that documents of both collections will be subjected to the same validation rules. Ain’t that cool?

You can be 100% permissive or enforce schemas and validate fields, on set, on save or both.

Installation:

From PyPi:

pip install pyArango

For the latest version:

git clone https://github.com/tariqdaouda/pyArango.git
cd pyArango
python setup.py develop

Quickstart:

pyArango’s github has list of examples to get you started here.

Contents:

Connection

class pyArango.connection.AikidoSession(username, password, verify=True, max_conflict_retries=5, max_retries=5, single_session=True, log_requests=False, pool_maxsize=10, timeout=30)[source]

Magical Aikido being that you probably do not need to access directly that deflects every http request to requests in the most graceful way. It will also save basic stats on requests in it’s attribute ‘.log’.

class pyArango.connection.Connection(arangoURL='http://127.0.0.1:8529', username=None, password=None, verify=True, verbose=False, statsdClient=None, reportFileName=None, loadBalancing='round-robin', use_grequests=False, use_jwt_authentication=False, use_lock_for_reseting_jwt=True, max_retries=5, max_conflict_retries=5, pool_maxsize=10, timeout=30)[source]

This is the entry point in pyArango and directly handles databases. @param arangoURL: can be either a string url or a list of string urls to different coordinators @param use_grequests: allows for running concurent requets.

arangoURL: list or str
list of urls or url for connecting to the db
username: str
for credentials
password: str
for credentials
verify: bool
check the validity of the CA certificate
verbose: bool
flag for addictional prints during run
statsdClient: instance
statsd instance
reportFileName: str
where to save statsd report
loadBalancing: str
type of load balancing between collections
use_grequests: bool
parallelise requests using gevents. Use with care as gevents monkey patches python, this could have unintended concequences on other packages
use_jwt_authentication: bool
use JWT authentication
use_lock_for_reseting_jwt: bool
use lock for reseting gevents authentication
max_retries: int
max number of retries for a request
max_conflict_retries: int
max number of requests for a conflict error (1200 arangodb error). Does not work with gevents (grequests),
pool_maxsize: int
max number of open connections. (Not intended for grequest)
timeout: int
number of seconds to wait on a hanging connection before giving up
createDatabase(name, **dbArgs)[source]

use dbArgs for arguments other than name. for a full list of arguments please have a look at arangoDB’s doc

getDatabasesURL()[source]

return an URL to the databases

getEndpointURL()[source]

return an endpoint url applying load balacing strategy

getURL()[source]

return an URL for the connection

getVersion()[source]

fetches the arangodb server version

hasDatabase(name)[source]

returns true/false wether the connection has a database by the name of ‘name’

reload()[source]

Reloads the database list. Because loading a database triggers the loading of all collections and graphs within, only handles are loaded when this function is called. The full databases are loaded on demand when accessed

resetSession(username=None, password=None, verify=True)[source]

resets the session

updateEndpoints(coordinatorURL=None)[source]

udpdates the list of available endpoints from the server

class pyArango.connection.JsonHook(ret)[source]

This one replaces requests’ original json() function. If a call to json() fails, it will print a message with the request content

Database

class pyArango.database.Database(connection, name)[source]

Databases are meant to be instanciated by connections

AQLQuery(query, batchSize=100, rawResults=False, bindVars=None, options=None, count=False, fullCount=False, json_encoder=None, **moreArgs)[source]

Set rawResults = True if you want the query to return dictionnaries instead of Document objects. You can use **moreArgs to pass more arguments supported by the api, such as ttl=60 (time to live)

createCollection(className='Collection', **colProperties)[source]

Creates a collection and returns it. ClassName the name of a class inheriting from Collection or Egdes, it can also be set to ‘Collection’ or ‘Edges’ in order to create untyped collections of documents or edges. Use colProperties to put things such as ‘waitForSync = True’ (see ArangoDB’s doc for a full list of possible arugments). If a ‘_properties’ dictionary is defined in the collection schema, arguments to this function overide it

createGraph(name, createCollections=True, isSmart=False, numberOfShards=None, smartGraphAttribute=None, replicationFactor=None, writeConcern=None)[source]

Creates a graph and returns it. ‘name’ must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges definition exist. Raises a ValueError in case of a non-existing collection.

dropAllCollections()[source]

drops all public collections (graphs included) from the database

explainAQLQuery(query, bindVars=None, allPlans=False)[source]

Returns an explanation of the query. Setting allPlans to True will result in ArangoDB returning all possible plans. False returns only the optimal plan

fetchDocument(_id)[source]

fetchs a document using it’s _id

fetch_element(aql_query, bind_vars=None, dont_raise_error_if_empty=False, default_output=None, logger=None, log_level=10)[source]

Fetch element by running a query.

aql_query : str
aql query string.
bind_vars : dict, optional
dictonary of bind variables (the default is None)
dont_raise_error_if_empty: bool, optional
do not raise error if the returned is empty. (the default is False)
default_output: dict, optional
default output if no value is returned. (the default is None)
logger : Logger, optional
logger to log the query and result. (the default is None means don’t log)
log_level: Logger.loglevel, optional
level of the log. (the default is logging.DEBUG)
AQLFetchError
When unable to fetch results or more than one 1 results returned.
any
an element returned by query.
fetch_list(aql_query, bind_vars=None, batch_size=200, dont_raise_error_if_empty=False, logger=None, log_level=10)[source]

Fetch list of elements by running a query and merging all the batches.

aql_query : str
aql query string.
bind_vars : dict, optional
dictonary of bind variables (the default is None)
batch_size : int, optional
fetching batch size (the default is 200)
dont_raise_error_if_empty: bool, optional
do not raise error if the returned is empty. (the default is False)
logger : Logger, optional
logger to log the query and result. (the default is None means don’t log)
log_level: Logger.loglevel, optional
level of the log. (the default is logging.DEBUG)
AQLFetchError
When unable to fetch results
list(any)
a list returned by query.
fetch_list_as_batches(aql_query, bind_vars=None, batch_size=200, dont_raise_error_if_empty=False, logger=None, log_level=10)[source]

Fetch list of elements as batches by running the query.

Generator which yeilds each batch as result.

aql_query : str
aql query string.
bind_vars : dict, optional
dictonary of bind variables (the default is None)
batch_size : int, optional
fetching batch size (the default is 200)
dont_raise_error_if_empty: bool, optional
do not raise error if the returned is empty. (the default is False)
logger : Logger, optional
logger to log the query and result. (the default is None means don’t log)
log_level: Logger.loglevel, optional
level of the log. (the default is logging.DEBUG)
AQLFetchError
When unable to fetch results
list(any)
a list returned by query.
hasCollection(name)[source]

returns true if the databse has a collection by the name of ‘name’

hasGraph(name)[source]

returns true if the databse has a graph by the name of ‘name’

no_fetch_run(aql_query, bind_vars=None, logger=None, log_level=10)[source]

Run query which doesn’t have a return.

aql_query : str
aql query string.
bind_vars : dict, optional
dictonary of bind variables (the default is None)
logger : Logger, optional
logger to log the query and result. (the default is None means don’t log)
log_level: Logger.loglevel, optional
level of the log. (the default is logging.DEBUG)
AQLFetchError
When able to fetch results.
reload()[source]

reloads collections and graphs

reloadCollections()[source]

reloads the collection list.

reloadGraphs()[source]

reloads the graph list

transaction(collections, action, waitForSync=False, lockTimeout=None, params=None)[source]

Execute a server-side transaction

validateAQLQuery(query, bindVars=None, options=None)[source]

returns the server answer is the query is valid. Raises an AQLQueryError if not

class pyArango.database.DBHandle(connection, name)[source]

As the loading of a Database also triggers the loading of collections and graphs within. Only handles are loaded first. The full database are loaded on demand in a fully transparent manner.

Collection

class pyArango.collection.Collection(database, jsonData)[source]

A document collection. Collections are meant to be instantiated by databases.

action(method, action, **params)[source]

A generic ‘fct’ for interacting everything that does not have an assigned ‘fct’.

activateCache(cacheSize)[source]

Activate the caching system.

Cached documents are only available through the __getitem__ interface.

bulkImport_json(filename, onDuplicate='error', formatType='auto', **params)[source]

Bulk import from a file following the ArangoDB key-value format.

bulkImport_values(filename, onDuplicate='error', **params)[source]

Bulk import from a file following the ArangoDB json format.

bulkSave(docs, onDuplicate='error', **params)[source]

Parameter ‘docs’ must be either an iterable of documents or dictionaries.

This function will return the number of documents, created and updated, and will raise an UpdateError exception if there is at least one error. ‘params’ are any parameters from the ArangoDB documentation.

checksum()[source]

Return the current checksum.

count()[source]

Return the number of documents in the collection.

createDocument(initDict=None)[source]

Create and return a completely empty document unless the initial document is set via ‘initDict’.

deactivateCache()[source]

Deactivate the caching system.

delete()[source]

Delete the collection from the database.

empty()[source]

Alias for truncate.

ensureFulltextIndex(fields, minLength=None, name=None)[source]

Create a fulltext index if it does not already exist, then return it.

ensureGeoIndex(fields, name=None)[source]

Create a geo index if it does not already exist, then return it.

ensureHashIndex(fields, unique=False, sparse=True, deduplicate=False, name=None)[source]

Create a hash index if it does not already exist, then return it.

ensureIndex(index_type, fields, name=None, **index_args)[source]

Create an index of any type.

ensurePersistentIndex(fields, unique=False, sparse=True, deduplicate=False, name=None)[source]

Create a persistent index if it does not already exist, then return it.

ensureSkiplistIndex(fields, unique=False, sparse=True, deduplicate=False, name=None)[source]

Create a skiplist index if it does not already exist, then return it.

ensureTTLIndex(fields, expireAfter, unique=False, sparse=True, name=None)[source]

Create a TTL index if it does not already exist, then return it.

fetchAll(rawResults=False, **queryArgs)[source]

Returns all the documents in the collection. You can use the optinal arguments ‘skip’ and ‘limit’:

fetchAlll(limit = 3, shik = 10)
fetchByExample(exampleDict, batchSize, rawResults=False, **queryArgs)[source]

‘exampleDict’ should be something like {‘age’ : 28}.

fetchDocument(key, rawResults=False, rev=None)[source]

Fetche a document from the collection given its key.

This function always goes straight to the db and bypasses the cache. If you want to take advantage of the cache use the ‘__getitem__’ interface: collection[key]

fetchFirstExample(exampleDict, rawResults=False)[source]

‘exampleDict’ should be something like {‘age’ : 28}.

Return the first example found that matches the example, still in a ‘SimpleQuery’ object.

figures()[source]

A more elaborate version of ‘count’, see the ArangoDB documentation for more.

getIndexes()[source]

Fill ‘self.indexes’ with all the indexes associated with the collection and return it.

getStatus()[source]

Return a word describing the status of the collection (loaded, loading, deleted, unloaded, newborn) instead of a number, if you prefer the number it is in ‘self.status’.

getType()[source]

Return a word describing the type of the collection (edges or ducments) instead of a number.

If you prefer the number it is in ‘self.type’.

classmethod hasField(fieldName)[source]

Return ‘True’ or ‘False’ whether the collection has field ‘K’ in its schema.

Use the dot notation for the nested fields: address.street

load()[source]

Load collection in memory.

properties()[source]

Return the current properties.

restoreIndexes(indexes_dct=None)[source]

Restore all previously removed indexes.

revision()[source]

Return the current revision.

simpleQuery(queryType, rawResults=False, **queryArgs)[source]

General interface for simple queries.

‘queryType’ takes the arguments known to the ArangoDB, for instance: ‘all’ or ‘by-example’. See the ArangoDB documentation for a list of valid ‘queryType’s. If ‘rawResults’ is set to ‘True’, the query will return dictionaries instead of ‘Document’ objetcs.

truncate()[source]

Delete every document in the collection.

unload()[source]

Unload collection from memory.

validatePrivate(field, value)[source]

Validate a private field value.

class pyArango.collection.Edges(database, jsonData)[source]

The default edge collection. All edge Collections must inherit from it.

This one is meant to be called by the database.

createEdge(initValues=None)[source]

Create an edge populated with defaults.

getEdges(vertex, inEdges=True, outEdges=True, rawResults=False)[source]

Return in, out, or both edges linked to a given document.

Vertex can be either a ‘Document’ object or a string for an ‘_id’. If ‘rawResults’ is set to ‘True’, return the results just as fetched without any processing. Otherwise, return a list of Edge objects.

getInEdges(vertex, rawResults=False)[source]

An alias for ‘getEdges()’ that returns only the in ‘Edges’.

getOutEdges(vertex, rawResults=False)[source]

An alias for ‘getEdges()’ that returns only the out ‘Edges’.

classmethod validateField(fieldName, value)[source]

Check if ‘value’ is valid for field ‘fieldName’.

If the validation fails, raise a ‘SchemaViolation’ or a ‘ValidationError’. For nested dicts ex: {address : { street: xxx} }, ‘fieldName’ can take the form ‘address.street’.

class pyArango.collection.Field(validators=None, default=None)[source]

The class for defining pyArango fields.

Validators must be a list of validators.

‘default’ can also be a callable.

validate(value)[source]

Check the validity of ‘value’ given the list of validators.

class pyArango.collection.DocumentCache(cacheSize)[source]

Document cache for collection, with insert, deletes and updates in O(1).

delete(_key)[source]

Remove a document from the cache.

getChain()[source]

Return a list of keys representing the chain of documents.

stringify() → str[source]

Return a pretty string of ‘getChain()’.

class pyArango.collection.CachedDoc(document, prev, nextDoc)[source]

A cached document.

class pyArango.collection.Collection_metaclass[source]

The metaclass that takes care of keeping a register of all collection types.

classmethod getCollectionClass(name)[source]

Return the class object of a collection given its ‘name’.

classmethod isCollection(name) → bool[source]

return ‘True’ or ‘False’ whether ‘name’ is the name of collection.

classmethod isDocumentCollection(name) → bool[source]

Return ‘True’ or ‘False’ whether ‘name’ is the name of a document collection.

classmethod isEdgeCollection(name) → bool[source]

Return ‘True’ or ‘False’ whether ‘name’ is the name of an edge collection.

pyArango.collection.getCollectionClass(name) → bool[source]

Return ‘True’ or ‘False’ whether ‘name’ is the name of collection.

pyArango.collection.isCollection(name) → bool[source]

Return ‘True’ or ‘False’ whether ‘name’ is the name of a document collection.

pyArango.collection.isDocumentCollection(name) → bool[source]

Return ‘True’ or ‘False’ whether ‘name’ is the name of a document collection.

pyArango.collection.isEdgeCollection(name) → bool[source]

Return ‘True’ or ‘False’ whether ‘name’ is the name of an edge collection.

pyArango.collection.getCollectionClasses() → bool[source]

Return a dictionary of all defined collection classes.

Indexes

class pyArango.index.Index(collection, infos=None, creationData=None)[source]

An index on a collection’s fields. Indexes are meant to de created by ensureXXX functions of Collections. Indexes have a .infos dictionary that stores all the infos about the index

delete()[source]

Delete the index

restore()[source]

restore and index that has been previously deleted

Document

class pyArango.document.DocumentStore(collection, validators=None, initDct=None, patch=False, subStore=False, validateInit=False)[source]

Store all the data of a document in hierarchy of stores and handles validation. Does not store private information, these are in the document.

getPatches()[source]

get patches as a dictionary

getStore()[source]

get the inner store as dictionary

resetPatch()[source]

reset patches

set(dct)[source]

Set the store using a dictionary

validate()[source]

Validate the whole document

validateField(field)[source]

Validatie a field

class pyArango.document.Document(collection, jsonFieldInit=None, on_load_validation=False)[source]

The class that represents a document. Documents are meant to be instanciated by collections

delete()[source]

deletes the document from the database

forceSave(**docArgs)[source]

saves even if the document has not been modified since the last save

getEdges(edges, inEdges=True, outEdges=True, rawResults=False)[source]

returns in, out, or both edges linked to self belonging the collection ‘edges’. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects

getInEdges(edges, rawResults=False)[source]

An alias for getEdges() that returns only the in Edges

getOutEdges(edges, rawResults=False)[source]

An alias for getEdges() that returns only the out Edges

getPatches()[source]

return the patches in a dict format

getResponsibleShard()[source]

If we’re working with an arangodb cluster, we can use this method to fetch where a document lives.

getStore()[source]

return the store in a dict format

patch(keepNull=True, **docArgs)[source]

Saves the document by only updating the modified fields. The default behaviour concening the keepNull parameter is the opposite of ArangoDB’s default, Null values won’t be ignored Use docArgs for things such as waitForSync = True

reset(collection, jsonFieldInit=None, on_load_validation=False)[source]

replaces the current values in the document by those in jsonFieldInit

save(waitForSync=False, **docArgs)[source]

Saves the document to the database by either performing a POST (for a new document) or a PUT (complete document overwrite). If you want to only update the modified fields use the .patch() function. Use docArgs to put things such as ‘waitForSync = True’ (for a full list cf ArangoDB’s doc). It will only trigger a saving of the document if it has been modified since the last save. If you want to force the saving you can use forceSave()

saveCopy()[source]

saves a copy of the object and become that copy. returns a tuple (old _key, new _key)

set(fieldDict)[source]

set the document with a dictionary

setPrivates(fieldDict)[source]

will set self._id, self._rev and self._key field.

to_default()[source]

reset the document to the default values

validate()[source]

validate the document

class pyArango.document.Edge(edgeCollection, jsonFieldInit=None, on_load_validation=False)[source]

An Edge document

An alias to save that updates the _from and _to attributes. fromVertice and toVertice, can be either strings or documents. It they are unsaved documents, they will be automatically saved.

reset(edgeCollection, jsonFieldInit=None, on_load_validation=False)[source]

replaces the current values in the document by those in jsonFieldInit

save(**edgeArgs)[source]

Works like Document’s except that you must specify ‘_from’ and ‘_to’ vertices before. There’s also a links() function especially for first saves.

Users

class pyArango.users.User(users, jsonData=None)[source]

This class represents a user

delete()[source]

Permanently remove the user

save()[source]

Save/updates the user

setPermissions(dbName, access)[source]

Grant revoke rights on a database, ‘access’ is supposed to be boolean. ArangoDB grants/revokes both read and write rights at the same time

class pyArango.users.Users(connection)[source]

This one manages users.

fetchAllUsers(rawResults=False)[source]

Returns all available users. if rawResults, the result will be a list of python dicts instead of User objects

fetchUser(username, rawResults=False)[source]

Returns a single user. if rawResults, the result will be a list of python dicts instead of User objects

Query

class pyArango.query.Query(request, database, rawResults)[source]

This class is abstract and should not be instanciated. All query classes derive from it

If rawResults = True, the results will be returned as dictionaries instead of Document objects.

delete()[source]

kills the cursor

nextBatch()[source]

become the next batch. raises a StopIteration if there is None

class pyArango.query.AQLQuery(database, query, batchSize, bindVars, options, count, fullCount, rawResults=True, json_encoder=None, **moreArgs)[source]

AQL queries are attached to and instanciated by a database

explain(bindVars=None, allPlans=False)[source]

Returns an explanation of the query. Setting allPlans to True will result in ArangoDB returning all possible plans. False returns only the optimal plan

class pyArango.query.SimpleQuery(collection, queryType, rawResults, json_encoder=None, **queryArgs)[source]

Simple queries are attached to and instanciated by a collection

class pyArango.query.Cursor(database, cursorId, rawResults)[source]

Cursor queries are attached to and instanciated by a database, use them to continue from where you left

class pyArango.query.RawCursor(database, cursorId)[source]

a raw interface to cursors that returns json

Graph

class pyArango.graph.Graph(database, jsonInit)[source]

The class from witch all your graph types must derive

createEdge(collectionName, _fromId, _toId, edgeAttributes, waitForSync=False)[source]

creates an edge between two documents

createVertex(collectionName, docAttributes, waitForSync=False)[source]

adds a vertex to the graph and returns it

delete()[source]

deletes the graph

deleteEdge(edge, waitForSync=False)[source]

removes an edge from the graph

deleteVertex(document, waitForSync=False)[source]

deletes a vertex from the graph as well as al linked edges

A shorthand for createEdge that takes two documents as input

traverse(startVertex, **kwargs)[source]

Traversal! see: https://docs.arangodb.com/HttpTraversal/README.html for a full list of the possible kwargs. The function must have as argument either: direction = “outbout”/”any”/”inbound” or expander = “custom JS (see arangodb’s doc)”. The function can’t have both ‘direction’ and ‘expander’ as arguments.

deletes all links between doc1 and doc2

pyArango.graph.getGraphClass(name)[source]

alias for Graph_metaclass.getGraphClass()

pyArango.graph.isGraph(name)[source]

alias for Graph_metaclass.isGraph()

pyArango.graph.getGraphClasses()[source]

returns a dictionary of all defined graph classes

class pyArango.graph.Graph_metaclass[source]

Keeps track of all graph classes and does basic validations on fields

classmethod getGraphClass(name)[source]

return a graph class by its name

classmethod isGraph(name)[source]

returns true/false depending if there is a graph called name

class pyArango.graph.EdgeDefinition(edgesCollection, fromCollections, toCollections)[source]

An edge definition for a graph

Exceptions

exception pyArango.theExceptions.AQLFetchError(err_message)[source]

Raised error when fetching the data.

Error when unable to fetch.

err_message : str
error message.
exception pyArango.theExceptions.AQLQueryError(message, query, errors=None)[source]

Something went wrong with an aql query

exception pyArango.theExceptions.AbstractInstanciationError(cls)[source]

Raised when someone tries to instanciate an abstract class

exception pyArango.theExceptions.ArangoError(errorObject)[source]

a generic arangodb error object

exception pyArango.theExceptions.BulkOperationError(message)[source]

Something went wrong in one of the bulk operations. This error contains more errors

exception pyArango.theExceptions.ConnectionError(message, URL, statusCode='', errors=None)[source]

Something went wrong with the connection

exception pyArango.theExceptions.CreationError(message, errors=None)[source]

Something went wrong when creating something

exception pyArango.theExceptions.CursorError(message, cursorId, errors=None)[source]

Something went wrong when trying to fetch data with a cursor

exception pyArango.theExceptions.DeletionError(message, errors=None)[source]

Something went wrong when deleting something

exception pyArango.theExceptions.DocumentNotFoundError(message, errors=None)[source]
exception pyArango.theExceptions.ExportError(message, errors=None)[source]

Something went wrong using the export cursor

exception pyArango.theExceptions.IndexError(message, errors=None)[source]

wasn’t able to get the index

exception pyArango.theExceptions.InvalidDocument(errors)[source]

Raised when a Document does not respect schema/validation defined in its collection

exception pyArango.theExceptions.QueryError(message, errors=None)[source]

Something went wrong with an aql query

exception pyArango.theExceptions.SchemaViolation(collection, field, errors=None)[source]

Raised when someone tries to add a new field to an object belonging a to a Collection with enforced schema

exception pyArango.theExceptions.SimpleQueryError(message, errors=None)[source]

Something went wrong with a simple query

exception pyArango.theExceptions.TransactionError(message, action, errors=None)[source]

Something went wrong with a transaction

exception pyArango.theExceptions.TraversalError(message, errors=None)[source]

Something went wrong when doing a graph traversal

exception pyArango.theExceptions.UniqueConstrainViolation(message, errors=None)[source]

Violation of a unique key

exception pyArango.theExceptions.UpdateError(message, errors=None)[source]

Something went wrong when updating something

exception pyArango.theExceptions.ValidationError(message, errors=None)[source]

Something went wrong when validating something

exception pyArango.theExceptions.pyArangoException(message, errors=None)[source]

The calss from witch all Exceptions inherit

Validation

class pyArango.validation.Bool(*args, **kwrags)[source]

The value must be a boolean

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Email(*args, **kwrags)[source]

Checks if the field contains an emailaddress

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Enumeration(allowed)[source]

The value must be in the allowed ones

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Int(*args, **kwrags)[source]

The value must be an integer

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Length(minLen, maxLen)[source]

validates that the value length is between given bounds

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.NotNull(reject_zero=False, reject_empty_string=True)[source]

Checks that the Field has a non null value. False is not considered a Null Value

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Numeric(*args, **kwrags)[source]

checks if the value is numerical

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Range(lower, upper)[source]

The value must une [lower, upper] range

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.String(*args, **kwrags)[source]

The value must be a string or unicode

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

class pyArango.validation.Validator(*args, **kwrags)[source]

All validators must inherit from this class

validate(value)[source]

The only function that a validator must implement. Must return True if erevything went well or a ValidationError otherwise

Admin

class pyArango.admin.Admin(connection)[source]

administrative tasks with arangodb

status()[source]

fetches the server status.

CA Certificate

class pyArango.ca_certificate.CA_Certificate(certificate, encoded)[source]

A CA certificate. If encoded is True the certificate will be automatically base64 decoded

clean()[source]

erases the tmp_file containing the certificate

get_file_path()[source]

saves the cetificate into a tmp file and returns the file path

Foxx

All foxx related methods.

class pyArango.foxx.Foxx(database)[source]

A generic foxx function executor.

Initialise database and its services.

service(mount)[source]

Return a service so that only route after the mount.

mount : str
mount point.
FoxxService
A mounted service
class pyArango.foxx.FoxxService(database, mount)[source]

A foxx mount function executor.

Initialise mount and database.

end_point_url

End point url for foxx service.

JW Auth

class pyArango.jwauth.JWTAuth(username, password, urls, use_lock_for_reseting_jwt=False, max_retries=5)[source]

Tasks

All Task related methods.

class pyArango.tasks.Tasks(database)[source]

Tasks for database.

Initialise the database.

create(name, command, params=None, period=None, offset=None, task_id=None)[source]

Create a task with given command and its parameters.

delete(task_id)[source]

Delete the task for given task_id.

drop()[source]

delete all tasks

fetch(task_id=None)[source]

Fetch the task for given task_id. If task_id is None return all tasks

Gevent

Indices and tables