diff --git a/src/gismo_data/db_context.py b/src/gismo_data/db_context.py index b40a8f1..77ea0b1 100644 --- a/src/gismo_data/db_context.py +++ b/src/gismo_data/db_context.py @@ -15,7 +15,13 @@ class DBContext(DatabaseContext): def connect(self, database_settings: DatabaseSettings): try: self._logger.debug(__name__, "Connecting to database") - super(DBContext, self).connect(database_settings) + self._db.connect(database_settings) + for table in self._tables: + self._logger.debug(__name__, f"Create table if not exists: {table}") + self._logger.trace(__name__, f'Send SQL command: {table.get_create_string()}') + self._db.cursor.execute(table.get_create_string()) + + self.save_changes() self._logger.info(__name__, "Connected to database") except Exception as e: self._logger.fatal(__name__, "Connecting to database failed", e)