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>
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 @@
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