From 330b744c9ef3ed5ad11209c3cadbeec473d7d44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Fri, 21 Jun 2024 22:42:11 +0200 Subject: [PATCH] Change psycopg version from 3 to 2 --- db.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db.py b/db.py index b977983..efb35f7 100644 --- a/db.py +++ b/db.py @@ -91,11 +91,11 @@ elif config['DB_ENGINE'] == 'mysql': db.close() return res elif config['DB_ENGINE'] == 'postgres': - import psycopg # pylint: disable=import-error + import psycopg2 # pylint: disable=import-error def get_dbcursor(): - if 'db' not in g or g.db.broken: - g.db = psycopg.Connection.connect( + if 'db' not in g or g.db.closed: + g.db = psycopg2.connect( host=config["POSTGRES_HOST"], port=config["POSTGRES_PORT"], user=config["POSTGRES_USER"], @@ -133,7 +133,7 @@ def query(operation, *params, delim="sep", nlfix=True): try: rows = cur.fetchall() except Exception as e: # pylint: disable=broad-except - if str(e) == 'No result set to fetch from.' or str(e) == "the last operation didn't produce a result": + if str(e) == 'no results to fetch' or str(e) == "the last operation didn't produce a result": # no problem, we were just at the end of the result set pass else: -- GitLab