From 21ef95965bda7304e485fbf9b3b55c7eb2c787b8 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 12 Apr 2022 11:57:41 +0300 Subject: Remove unused database code Remove code for connecting to the database that is not actually used in the application in any sensible form. --- wqflask/wqflask/database.py | 11 ----------- wqflask/wqflask/views.py | 3 --- 2 files changed, 14 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/database.py b/wqflask/wqflask/database.py index 9f659ae6..c89216cf 100644 --- a/wqflask/wqflask/database.py +++ b/wqflask/wqflask/database.py @@ -27,17 +27,6 @@ def sql_uri(): "GN2_SETTINGS", os.path.abspath("../etc/default_settings.py")), "SQL_URI")) -engine = create_engine(sql_uri(), encoding="latin1") - -db_session = scoped_session(sessionmaker(autocommit=False, - autoflush=False, - bind=engine)) -Base = declarative_base() -Base.query = db_session.query_property() - -# Initialise the db -Base.metadata.create_all(bind=engine) - def parse_db_url(sql_uri: str) -> Tuple: """ Parse SQL_URI env variable from an sql URI diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 31e31875..1dd654df 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -98,8 +98,6 @@ from utility.benchmark import Bench from pprint import pformat as pf -from wqflask.database import db_session - import utility.logger @@ -120,7 +118,6 @@ def connect_db(): def shutdown_session(exception=None): db = getattr(g, '_database', None) if db is not None: - db_session.remove() g.db.dispose() g.db = None -- cgit v1.2.3