mirror of
https://github.com/fuckpiracyshield/data-storage.git
synced 2024-05-20 05:56:18 +02:00
30 lines
790 B
Python
30 lines
790 B
Python
from piracyshield_data_storage.database.arangodb.connection import DatabaseArangodbConnection
|
|
|
|
from arango.exceptions import AQLQueryExecuteError
|
|
|
|
class DatabaseArangodbDocument(DatabaseArangodbConnection):
|
|
|
|
max_batch_size = 50000
|
|
|
|
def collection(self, collection):
|
|
try:
|
|
return self.instance.collection(collection)
|
|
|
|
except:
|
|
raise DatabaseArangodbCollectionNotFoundException()
|
|
|
|
def query(self, aql, **kwargs):
|
|
try:
|
|
return self.instance.aql.execute(aql, batch_size = self.max_batch_size, **kwargs)
|
|
|
|
except AQLQueryExecuteError:
|
|
raise DatabaseArangodbQueryException()
|
|
|
|
class DatabaseArangodbCollectionNotFoundException(Exception):
|
|
|
|
pass
|
|
|
|
class DatabaseArangodbQueryException(Exception):
|
|
|
|
pass
|