Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Hongjing Chen <Hongjing.Chen@gov.bc.ca>
  • Loading branch information
chenhongjing committed Oct 11, 2024
1 parent 6974cdc commit 2c69570
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions python/common/sql-versioning/sql_versioning/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions python/common/sql-versioning/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2c69570

Please sign in to comment.