hub/persistence/base.py

19 lines
516 B
Python
Raw Normal View History

"""
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:
def __init__(self, db_name):
config = BaseConfiguration(db_name)
engine = create_engine(config.conn_string())
self.config = config
self.session = Session(engine)