aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2014-11-27 15:09:49 +0000
committerSteve McIntyre <steve.mcintyre@linaro.org>2014-11-27 15:09:49 +0000
commite38f622e2d5b879baecfbc1a19c90f93fe0cbbcb (patch)
tree5f8eff6adef67580fd641a5ea7b8c0240124930f /db
parent663dc06e8f4d6d539a433b8e7405ab018c30b838 (diff)
Separate out connection and cursor options
Older versions of psycopg2 / postgres need this, and there's no harm. Change-Id: I1e619d56b46a10dc9cd9bea97898c43c1bec1e4e Signed-off-by: Steve McIntyre <steve.mcintyre@linaro.org>
Diffstat (limited to 'db')
-rw-r--r--db/db.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/db/db.py b/db/db.py
index 6d42658..5089f36 100644
--- a/db/db.py
+++ b/db/db.py
@@ -25,9 +25,8 @@ from errors import CriticalError
class VlanDB:
def __init__(self, db_name="vland", username="vland"):
try:
- self.connection = psycopg2.connect(database=db_name, user=username,
- cursor_factory=psycopg2.extras.RealDictCursor)
- self.cursor = self.connection.cursor()
+ self.connection = psycopg2.connect(database=db_name, user=username)
+ self.cursor = self.connection.cursor(cursor_factory=psycopg2.extras.DictCursor)
except Exception as e:
print "Failed to access database: %s" % e