Make db manipulation bot work with db client

This commit is contained in:
Marek Wolan
2024-03-03 11:18:06 +00:00
parent 2a1d99ccce
commit 80158fd9b4
4 changed files with 51 additions and 14 deletions

View File

@@ -84,7 +84,14 @@ class DatabaseClient(Application):
)
return self.connected
def check_connection(self, connection_id:str) -> bool:
def check_connection(self, connection_id: str) -> bool:
"""Check whether the connection can be successfully re-established.
:param connection_id: connection ID to check
:type connection_id: str
:return: Whether the connection was successfully re-established.
:rtype: bool
"""
if not self._can_perform_action():
return False
print(self.query("SELECT * FROM pg_stat_activity", connection_id=connection_id))