Mercurial > hg > Feedworm
annotate backend/arangodb/ArangoDb.py @ 256:f79be01821c4
Arangodb backend, first version which barely works for reading
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 30 Jan 2019 07:11:10 +0100 |
parents | |
children |
rev | line source |
---|---|
256
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
2 |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
3 class ArangoDb(object): |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
4 def __init__(self, database): |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
5 super(ArangoDb, self).__init__() |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
6 self.database = database |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
7 |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
8 def get_or_create_collection(self, collection_name): |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
9 if self.database.hasCollection(collection_name): |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
10 return self.database[collection_name] |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
11 else: |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
12 return self.database.createCollection(name=collection_name) |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
13 |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
14 def AQLQuery(self, query, bind_vars={}): |
f79be01821c4
Arangodb backend, first version which barely works for reading
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
15 return self.database.AQLQuery(query, bindVars=bind_vars) |