Skip to content

Commit

Permalink
report no locks found when run
Browse files Browse the repository at this point in the history
  • Loading branch information
floptical committed Apr 26, 2024
1 parent 04b09ce commit 5fa4971
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion databridge_etl_tools/db2/db2.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def remove_locks(self, table, schema, lock_type=None):
self.pg_cursor.execute(lock_stmt)
locks = self.pg_cursor.fetchall()
if locks:
self.logger.info('Locks on table found!!')
self.logger.info(f'Locks on table "{schema}.{table}" found!!')
for p in locks:
pid = p[0]
lock = p[1]
Expand All @@ -345,6 +345,8 @@ def remove_locks(self, table, schema, lock_type=None):
self.logger.info(f'Killing pid: "{pid}" with lock type "{lock}"')
self.pg_cursor.execute(f'SELECT pg_terminate_backend({pid});')
self.pg_cursor.execute(f'COMMIT')
else:
self.logger.info(f'No locks on table "{schema}.{table}" found.')

def create_staging_from_enterprise(self):
self.confirm_table_existence()
Expand Down

0 comments on commit 5fa4971

Please sign in to comment.