feat(db): decouple SqliteDatabase from config object

- Simplify init args to path (None means use memory), logger, and verbose
- Add docstrings to SqliteDatabase (it had almost none)
- Update all usages of the class
This commit is contained in:
psychedelicious
2023-12-12 10:29:46 +11:00
parent afe4e55bf9
commit 417db71471
8 changed files with 80 additions and 47 deletions

View File

@ -47,7 +47,8 @@ class MigrateModelYamlToDb:
def get_db(self) -> ModelRecordServiceSQL:
"""Fetch the sqlite3 database for this installation."""
db = SqliteDatabase(self.config, self.logger)
db_path = None if self.config.use_memory_db else self.config.db_path
db = SqliteDatabase(db_path=db_path, logger=self.logger, verbose=self.config.log_sql)
return ModelRecordServiceSQL(db)
def get_yaml(self) -> DictConfig: