From a57fd5d558b1486478ddc82b724398012c7c69af Mon Sep 17 00:00:00 2001 From: Konstantin Schulz Date: Mon, 18 May 2020 19:04:46 +0200 Subject: [PATCH] introduce detailed logging for every database action --- mc_backend/mcserver/app/api/corpusListAPI.py | 1 + mc_backend/mcserver/app/services/databaseService.py | 1 + mc_backend/mcserver/config.py | 1 + 3 files changed, 3 insertions(+) diff --git a/mc_backend/mcserver/app/api/corpusListAPI.py b/mc_backend/mcserver/app/api/corpusListAPI.py index 7f9845c..10e9b08 100644 --- a/mc_backend/mcserver/app/api/corpusListAPI.py +++ b/mc_backend/mcserver/app/api/corpusListAPI.py @@ -16,6 +16,7 @@ def get(last_update_time: int) -> Union[Response, ConnexionResponse]: ui_cts: UpdateInfo try: ui_cts = db.session.query(UpdateInfo).filter_by(resource_type=ResourceType.cts_data.name).first() + db.session.commit() except (InvalidRequestError, OperationalError): db.session.rollback() return NetworkService.make_json_response(None) diff --git a/mc_backend/mcserver/app/services/databaseService.py b/mc_backend/mcserver/app/services/databaseService.py index 2665027..654fd5a 100644 --- a/mc_backend/mcserver/app/services/databaseService.py +++ b/mc_backend/mcserver/app/services/databaseService.py @@ -20,6 +20,7 @@ class DatabaseService: def check_corpus_list_age(app: Flask) -> None: """ Checks whether the corpus list needs to be updated. If yes, it performs the update. """ ui_cts: UpdateInfo = db.session.query(UpdateInfo).filter_by(resource_type=ResourceType.cts_data.name).first() + db.session.commit() if ui_cts is None: return else: diff --git a/mc_backend/mcserver/config.py b/mc_backend/mcserver/config.py index 74e5769..8980403 100644 --- a/mc_backend/mcserver/config.py +++ b/mc_backend/mcserver/config.py @@ -127,6 +127,7 @@ class Config(object): SERVER_URI_VOCABULARY = SERVER_URI_BASE + "vocabulary" # END endpoints SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") or DATABASE_URL_SQLITE + SQLALCHEMY_ECHO = True SQLALCHEMY_TRACK_MODIFICATIONS = False STATIC_EXERCISES_REPOSITORY_URL = "https://scm.cms.hu-berlin.de/callidus/machina-callida/-/archive/master/machina-callida-master.zip?path=mc_frontend%2Fsrc%2Fassets%2Fh5p" STOP_WORDS_LATIN_PATH = os.path.join(CACHE_DIRECTORY, "stop_words_latin.json") -- GitLab