Browse Source

Created the structure of pymongo Datasource

Roland Haroutiounian 8 years ago
parent
commit
f5cfdb76c0
3 changed files with 30 additions and 0 deletions
  1. 1
    0
      lodel/datasource/__init__.py
  2. 28
    0
      lodel/datasource/mongodb_datasource.py
  3. 1
    0
      requirements.txt

+ 1
- 0
lodel/datasource/__init__.py View File

@@ -0,0 +1 @@
1
+__author__ = 'roland'

+ 28
- 0
lodel/datasource/mongodb_datasource.py View File

@@ -0,0 +1,28 @@
1
+# -*- coding: utf-8 -*-
2
+import pymongo
3
+from pymongo import MongoClient
4
+
5
+
6
+DEFAULT_CONNECTION = {
7
+    'host': 'localhost',
8
+    'port': 27017,
9
+    'dbname': 'lodel'
10
+}
11
+
12
+class MongoDbDataSource(object):
13
+
14
+    def __init__(self, module=pymongo, connection_args=DEFAULT_CONNECTION):
15
+        self.connection = MongoClient(connection_args['host'], connection_args['port'])
16
+        self.database = self.connection[connection_args['dbname']]
17
+
18
+    def select(self):
19
+        pass
20
+
21
+    def delete(self):
22
+        pass
23
+
24
+    def update(self):
25
+        pass
26
+
27
+    def insert(self):
28
+        pass

+ 1
- 0
requirements.txt View File

@@ -6,6 +6,7 @@ logilab-common==1.2.0
6 6
 MarkupSafe==0.23
7 7
 pep8==1.6.2
8 8
 pylint==1.4.4
9
+pymongo==3.2.2
9 10
 six==1.10.0
10 11
 Werkzeug==0.11.4
11 12
 wrapt==1.10.6

Loading…
Cancel
Save