From bb0412bb5c90a9dbf98c5687979c0ed1c437debb Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 28 Mar 2024 16:05:28 +0300 Subject: [PATCH] dblog-fix --- services/db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/db.py b/services/db.py index 8d54858a..409308be 100644 --- a/services/db.py +++ b/services/db.py @@ -92,6 +92,7 @@ warnings.simplefilter('always', exc.SAWarning) @event.listens_for(Engine, 'before_cursor_execute') def before_cursor_execute(conn, cursor, statement, parameters, context, executemany): conn.query_start_time = time.time() + conn.last_statement = '' # noinspection PyUnusedLocal @@ -105,6 +106,6 @@ def after_cursor_execute(conn, cursor, statement, parameters, context, executema if parameters else f'{statement}'.replace('\n', ' ') ) - if elapsed > 1 and str(conn.last_executed_statement()) != str(statement): - conn.executed_statement = conn.statement + if elapsed > 1 and str(conn.last_statement) != str(statement): + conn.last_statement = str(conn.statement) logger.debug(f"\n{query}\n{'*' * math.floor(elapsed)} {elapsed:.3f} s\n")