From e9eccf836cf33b701a53e4ac5590cdb4b1080619 Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Thu, 21 Sep 2023 18:06:13 +0200 Subject: [PATCH] update sqlalchemy invocation --- apolpi.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apolpi.py b/apolpi.py index dd2e791..f4b12ad 100644 --- a/apolpi.py +++ b/apolpi.py @@ -103,11 +103,12 @@ def _fetch(): - roles = db.engine.execute(QUERY) - out = [] - for role in roles: - out.append(dict(zip(columns, role))) - return out + with db.engine.connect() as connection: + roles = connection.execute(QUERY) + out = [] + for role in roles: + out.append(dict(zip(columns, role))) + return out @app.route("/organism/findAllOrganisms", methods=["GET", "POST"])