Collection¶
-
class
pyArango.collection.
Collection
(database, jsonData)[source]¶ A document collection. Collections are meant to be instanciated by databases
-
action
(method, action, **params)[source]¶ a generic fct for interacting everything that doesn’t 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 repecting arango’s key/value format
-
bulkImport_values
(filename, onDuplicate='error', **params)[source]¶ bulk import from a file repecting arango’s json format
-
bulkSave
(docs, onDuplicate='error', **params)[source]¶ Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there’s at least one error. params are any parameters from arango’s documentation
-
createDocument
(initDict=None)[source]¶ create and returns a completely empty document or one populated with initDict
-
ensureFulltextIndex
(fields, minLength=None, name=None)[source]¶ Creates a fulltext index if it does not already exist, and returns it
-
ensureGeoIndex
(fields, name=None)[source]¶ Creates a geo index if it does not already exist, and returns it
-
ensureHashIndex
(fields, unique=False, sparse=True, deduplicate=False, name=None)[source]¶ Creates a hash index if it does not already exist, and returns it
-
ensurePersistentIndex
(fields, unique=False, sparse=True, deduplicate=False, name=None)[source]¶ Creates a persistent index if it does not already exist, and returns it
-
ensureSkiplistIndex
(fields, unique=False, sparse=True, deduplicate=False, name=None)[source]¶ Creates a skiplist index if it does not already exist, and returns it
-
ensureTTLIndex
(fields, expireAfter, unique=False, sparse=True, name=None)[source]¶ Creates a TTL index if it does not already exist, and returns it
-
fetchAll
(rawResults=False, **queryArgs)[source]¶ Returns all the documents in the collection. You can use the optinal arguments ‘skip’ and ‘limit’:
fetchAll(limit = 3, skip = 10)
-
fetchByExample
(exampleDict, batchSize, rawResults=False, **queryArgs)[source]¶ exampleDict should be something like {‘age’ : 28}
-
fetchDocument
(key, rawResults=False, rev=None)[source]¶ Fetches a document from the collection given it’s 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}. returns only a single element but still in a SimpleQuery object. returns the first example found that matches the example
-
getIndexes
()[source]¶ Fills self.indexes with all the indexes associates with the collection and returns it
-
getStatus
()[source]¶ returns a word describing the status of the collection (loaded, loading, deleted, unloaded, newborn) instead of a number, if you prefer the number it’s in self.status
-
getType
()[source]¶ returns a word describing the type of the collection (edges or ducments) instead of a number, if you prefer the number it’s in self.type
-
classmethod
hasField
(fieldName)[source]¶ returns True/False wether the collection has field K in it’s schema. Use the dot notation for the nested fields: address.street
-
-
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
-
getEdges
(vertex, inEdges=True, outEdges=True, rawResults=False)[source]¶ returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects
-
getInEdges
(vertex, rawResults=False)[source]¶ An alias for getEdges() that returns only the in Edges
-
-
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
-
class
pyArango.collection.
DocumentCache
(cacheSize)[source]¶ Document cache for collection, with insert, deletes and updates in O(1)
-
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)[source]¶ return true or false wether ‘name’ is the name of collection.
-
classmethod
-
pyArango.collection.
getCollectionClass
(name)[source]¶ return true or false wether ‘name’ is the name of collection.
-
pyArango.collection.
isCollection
(name)[source]¶ return true or false wether ‘name’ is the name of a document collection.
-
pyArango.collection.
isDocumentCollection
(name)[source]¶ return true or false wether ‘name’ is the name of a document collection.