diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2014-11-27 15:09:49 +0000 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2014-11-27 15:09:49 +0000 |
commit | e38f622e2d5b879baecfbc1a19c90f93fe0cbbcb (patch) | |
tree | 5f8eff6adef67580fd641a5ea7b8c0240124930f /db | |
parent | 663dc06e8f4d6d539a433b8e7405ab018c30b838 (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.py | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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 |