From 2c6957012a1c6ad5ea8fd88cf08925e059be0de6 Mon Sep 17 00:00:00 2001 From: Hongjing Chen Date: Fri, 11 Oct 2024 16:05:50 -0700 Subject: [PATCH] small tweaks Signed-off-by: Hongjing Chen --- python/common/sql-versioning/sql_versioning/versioning.py | 4 ++-- python/common/sql-versioning/tests/conftest.py | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/python/common/sql-versioning/sql_versioning/versioning.py b/python/common/sql-versioning/sql_versioning/versioning.py index 0d5c4974b..8a34ff5dd 100644 --- a/python/common/sql-versioning/sql_versioning/versioning.py +++ b/python/common/sql-versioning/sql_versioning/versioning.py @@ -48,7 +48,7 @@ def _is_obj_modified(obj): def _is_session_modified(session): - """Check if the session contains modified objects. + """Check if the session contains modified versioned objects. :param session: The database sesseion instance. :return: True if the session contains modified versioned objects, otherwise False. @@ -242,7 +242,7 @@ def _before_flush(session, flush_context, instances): """Trigger before a flush operation to ensure a transaction is created.""" try: if not _is_session_modified(session): - print('\033[31mThere is no modified object in this session.\033[0m') + print('\033[31mThere is no modified versioned object in this session.\033[0m') return transaction_manager = TransactionManager(session) transaction_manager.create_transaction() diff --git a/python/common/sql-versioning/tests/conftest.py b/python/common/sql-versioning/tests/conftest.py index 9466d7aa8..110da1ba9 100644 --- a/python/common/sql-versioning/tests/conftest.py +++ b/python/common/sql-versioning/tests/conftest.py @@ -37,11 +37,7 @@ def session(db): # create tables Base.metadata.drop_all(engine) - Base.metadata.create_all(engine) - - # TODO: debug - for table in Base.metadata.tables: - print(f'Creating table: {table}') + Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) session = Session()