2022-11-03 15:29:09 -04:00
|
|
|
"""
|
|
|
|
Base repository class to establish db connection
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Peter Yefi peteryefi@gmail.com
|
|
|
|
"""
|
|
|
|
|
|
|
|
from persistence.db_config import BaseConfiguration
|
|
|
|
from sqlalchemy import create_engine
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
|
|
|
|
|
|
|
|
class BaseRepo:
|
2022-11-11 16:16:31 -05:00
|
|
|
def __init__(self, db_name):
|
|
|
|
config = BaseConfiguration(db_name)
|
2022-11-03 15:29:09 -04:00
|
|
|
engine = create_engine(config.conn_string())
|
2022-11-11 16:16:31 -05:00
|
|
|
self.config = config
|
2022-11-03 15:29:09 -04:00
|
|
|
self.session = Session(engine)
|