Add logging for models

This commit is contained in:
norohind committed 2021-11-28 14:03:39 +03:00
1 parent 1a692df820
commit 702ab34154
3 files changed
+9 -2

No files matched your search

+3
View File
@@ -27,12 +27,15 @@ class PostgresModel(AbstractModel):
database=os.environ['DB_DATABASE'], # test0
cursor_factory=psycopg2.extras.DictCursor)
logger.info(f'Connected to {self.db.dsn}')
with self.db:
with self.db.cursor() as cursor:
cursor.execute(postgres_sql_requests.schema_create) # schema creation
def close_model(self):
self.db.close()
logger.info(f'Connection to {self.db.dsn} closed successfully')
def get_activity_changes(self, platform: str, leaderboard_type: str, limit: int, low_timestamp, high_timestamp)\
-> list: